Skip to content

Commit

Permalink
Merge pull request #39 from medreporter/rearrange-properties
Browse files Browse the repository at this point in the history
Rearrange properties
  • Loading branch information
julihereu authored Jan 28, 2024
2 parents 2c0e7e8 + 54d420b commit 758cc5e
Show file tree
Hide file tree
Showing 34 changed files with 289 additions and 213 deletions.
30 changes: 28 additions & 2 deletions locales/de/designer.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,36 @@
BooleanDefaultProperty:
label: Default
BorderProperty:
label: Begrenzung
DisabledProperty:
label: Deaktiviert
EditorItem:
id: ID
type: Typ
FieldIdProperty:
label: ID
FigureProperties:
figureTitle: Abbildung
FigureProperty:
label: Abbildung
FreeTextDefaultProperty:
label: Default
HiddenProperty:
label: Ausgeblendet
InfoProperty:
label: Info
LabelProperty:
label: Bezeichnung
LinkProperty:
label: Link
ListProperty:
label: Liste
MarkdownEditorButton:
title: Markdown Editor
MarkdownEditorModal:
modalTitle: Markdown Editor
editorLabel: Editor
previewLabel: Vorschau
MaxProperty:
label: Maximum
MenuPanel:
booleanFieldLabel: Boolisch
components: Komponenten
Expand All @@ -36,8 +48,14 @@ MenuPanel:
structure: Struktur
timeFieldLabel: Zeit
statementLabel: Aussage
MinProperty:
label: Minimum
MultilineProperty:
label: Mehrzeilig
NewTemplate:
navbarTitle: Neue Vorlage
NumberDefaultProperty:
label: Default
OptionsEditorButton:
label_one: "{{count}} Option"
label_other: "{{count}} Optionen"
Expand All @@ -50,16 +68,24 @@ OptionsFormEditor:
OptionsTable:
labelColumnHeader: Bezeichnung
valueColumnHeader: Wert
PrecisionProperty:
label: Nachkommastellen
PreviewSwitch:
label: Vorschau
PropertiesPanel:
panelTitle: Eigenschaften
deleteItemButtonLabel: Löschen
TemplatePropertiesButton:
title: Vorlageneigenschaften
StartProperty:
label: Startwert
StepProperty:
label: Schritt
TemplatePropertiesModal:
categoriesLabel: Kategorien
descriptionLabel: Beschreibung
identifierLabel: Bezeichner
languageLabel: Sprache
titleLabel: Title
WithSecondsProperty:
label: Mit Sekunden
30 changes: 28 additions & 2 deletions locales/en/designer.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,36 @@
BooleanDefaultProperty:
label: Default
BorderProperty:
label: Border
DisabledProperty:
label: Disabled
EditorItem:
id: ID
type: Type
FieldIdProperty:
label: ID
FigureProperties:
title: Figure
FigureProperty:
label: Figure
FreeTextDefaultProperty:
label: Default
HiddenProperty:
label: Hidden
InfoProperty:
label: Info
LabelProperty:
label: Label
LinkProperty:
label: Link
ListProperty:
label: List
MarkdownEditorButton:
title: Markdown Editor
MarkdownEditorModal:
modalTitle: Markdown Editor
editorLabel: Editor
previewLabel: Preview
MaxProperty:
label: Maximal value
MenuPanel:
booleanFieldLabel: Boolean
components: Components
Expand All @@ -36,8 +48,14 @@ MenuPanel:
structure: Structure
timeFieldLabel: Time
statementLabel: Statement
MinProperty:
label: Minimal value
MultilineProperty:
label: Multiline
NewTemplate:
navbarTitle: New Template
NumberDefaultProperty:
label: Default
OptionsEditorButton:
label_one: "{{count}} option"
label_other: "{{count}} options"
Expand All @@ -50,11 +68,17 @@ OptionsFormEditor:
OptionsTable:
labelColumnHeader: Label
valueColumnHeader: Value
PrecisionProperty:
label: Precision
PreviewSwitch:
label: Preview
PropertiesPanel:
panelTitle: Properties
deleteItemButtonLabel: Delete
StartProperty:
label: Start
StepProperty:
label: Step
TemplatePropertiesButton:
title: Template Properties
TemplatePropertiesModal:
Expand All @@ -63,3 +87,5 @@ TemplatePropertiesModal:
identifierLabel: Identifier
languageLabel: Language
titleLabel: Title
WithSecondsProperty:
label: With seconds
7 changes: 7 additions & 0 deletions src/components/designer/properties/BooleanDefaultProperty.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { useSiteTranslation } from "~/hooks/useSiteTranslation"
import { BooleanMetaProperty } from "./BooleanMetaProperty"

export const BooleanDefaultProperty = () => {
const { t } = useSiteTranslation()
return <BooleanMetaProperty name="default" label={t("BooleanDefaultProperty.label")} />
}
15 changes: 15 additions & 0 deletions src/components/designer/properties/BooleanMetaProperty.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { Switch } from "@mantine/core"
import { Controller } from "react-hook-form"

interface BooleanMetaPropertyProps {
name: string
label: string
}
export const BooleanMetaProperty = ({ name, label }: BooleanMetaPropertyProps) => (
<Controller
name={name}
render={({ field: { value, onChange }, fieldState: { error } }) => (
<Switch label={label} value={value} onChange={onChange} error={error?.message} />
)}
/>
)
7 changes: 7 additions & 0 deletions src/components/designer/properties/BorderProperty.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { useSiteTranslation } from "~/hooks/useSiteTranslation"
import { BooleanMetaProperty } from "./BooleanMetaProperty"

export const BorderProperty = () => {
const { t } = useSiteTranslation()
return <BooleanMetaProperty name="border" label={t("BorderProperty.label")} />
}
24 changes: 2 additions & 22 deletions src/components/designer/properties/DisabledProperty.tsx
Original file line number Diff line number Diff line change
@@ -1,27 +1,7 @@
import { Group, Textarea } from "@mantine/core"
import { Controller } from "react-hook-form"
import { useSiteTranslation } from "~/hooks/useSiteTranslation"
import { ScriptEditorButton } from "../scriptEditor/ScriptEditorButton"
import { ScriptEditorMetaProperty } from "./ScriptEditorMetaProperty"

export const DisabledProperty = () => {
const { t } = useSiteTranslation()

return (
<Controller
name="disabled"
render={({ field: { value, onChange }, fieldState: { error } }) => (
<Textarea
label={
<Group gap="xs" align="center">
{t("DisabledProperty.label")}
<ScriptEditorButton />
</Group>
}
value={value}
onChange={onChange}
error={error?.message}
/>
)}
/>
)
return <ScriptEditorMetaProperty name="disabled" label={t("DisabledProperty.label")} />
}
17 changes: 2 additions & 15 deletions src/components/designer/properties/FieldIdProperty.tsx
Original file line number Diff line number Diff line change
@@ -1,21 +1,8 @@
import { TextInput } from "@mantine/core"
import { Controller } from "react-hook-form"
import { useSiteTranslation } from "~/hooks/useSiteTranslation"
import { TextMetaProperty } from "./TextMetaProperty"

export const FieldIdProperty = () => {
const { t } = useSiteTranslation()

return (
<Controller
name="fieldId"
render={({ field: { value, onChange }, fieldState: { error } }) => (
<TextInput
label={t("FieldIdProperty.label")}
value={value}
onChange={onChange}
error={error?.message}
/>
)}
/>
)
return <TextMetaProperty label={t("FieldIdProperty.label")} name="id" />
}
24 changes: 24 additions & 0 deletions src/components/designer/properties/FigureProperty.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { Group, Textarea } from "@mantine/core"
import { Controller } from "react-hook-form"
import { useSiteTranslation } from "~/hooks/useSiteTranslation"

export const FigureProperty = () => {
const { t } = useSiteTranslation()
return (
<Controller
name="figure"
render={({ field: { value, onChange }, fieldState: { error } }) => (
<Textarea
label={
<Group gap="xs" align="center">
{t("FigureProperty.label")}
</Group>
}
value={value}
onChange={onChange}
error={error?.message}
/>
)}
/>
)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { useSiteTranslation } from "~/hooks/useSiteTranslation"
import { TextMetaProperty } from "./TextMetaProperty"

export const FreeTextDefaultProperty = () => {
const { t } = useSiteTranslation()
return <TextMetaProperty name="default" label={t("FreeTextDefaultProperty.label")} />
}
23 changes: 2 additions & 21 deletions src/components/designer/properties/HiddenProperty.tsx
Original file line number Diff line number Diff line change
@@ -1,27 +1,8 @@
import { Group, Textarea } from "@mantine/core"
import { Controller } from "react-hook-form"
import { useSiteTranslation } from "~/hooks/useSiteTranslation"
import { ScriptEditorButton } from "../scriptEditor/ScriptEditorButton"
import { ScriptEditorMetaProperty } from "./ScriptEditorMetaProperty"

export const HiddenProperty = () => {
const { t } = useSiteTranslation()

return (
<Controller
name="hidden"
render={({ field: { value, onChange }, fieldState: { error } }) => (
<Textarea
label={
<Group gap="xs" align="center">
{t("HiddenProperty.label")}
<ScriptEditorButton />
</Group>
}
value={value}
onChange={onChange}
error={error?.message}
/>
)}
/>
)
return <ScriptEditorMetaProperty name="hidden" label={t("HiddenProperty.label")} />
}
17 changes: 2 additions & 15 deletions src/components/designer/properties/LabelProperty.tsx
Original file line number Diff line number Diff line change
@@ -1,21 +1,8 @@
import { TextInput } from "@mantine/core"
import { Controller } from "react-hook-form"
import { useSiteTranslation } from "~/hooks/useSiteTranslation"
import { TextMetaProperty } from "./TextMetaProperty"

export const LabelProperty = () => {
const { t } = useSiteTranslation()

return (
<Controller
name="label"
render={({ field: { value, onChange }, fieldState: { error } }) => (
<TextInput
label={t("LabelProperty.label")}
value={value}
onChange={onChange}
error={error?.message}
/>
)}
/>
)
return <TextMetaProperty name="label" label={t("LabelProperty.label")} />
}
7 changes: 7 additions & 0 deletions src/components/designer/properties/LinkProperty.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { useSiteTranslation } from "~/hooks/useSiteTranslation"
import { TextMetaProperty } from "./TextMetaProperty"

export const LinkProperty = () => {
const { t } = useSiteTranslation()
return <TextMetaProperty name="link" label={t("LinkProperty.label")} />
}
7 changes: 7 additions & 0 deletions src/components/designer/properties/ListProperty.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { useSiteTranslation } from "~/hooks/useSiteTranslation"
import { BooleanMetaProperty } from "./BooleanMetaProperty"

export const ListProperty = () => {
const { t } = useSiteTranslation()
return <BooleanMetaProperty name="list" label={t("ListProperty.label")} />
}
7 changes: 7 additions & 0 deletions src/components/designer/properties/MaxProperty.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { useSiteTranslation } from "~/hooks/useSiteTranslation"
import { NumberMetaProperty } from "./NumberMetaProperty"

export const MaxProperty = () => {
const { t } = useSiteTranslation()
return <NumberMetaProperty name="max" label={t("MaxProperty.label")} />
}
7 changes: 7 additions & 0 deletions src/components/designer/properties/MinProperty.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { useSiteTranslation } from "~/hooks/useSiteTranslation"
import { NumberMetaProperty } from "./NumberMetaProperty"

export const MinProperty = () => {
const { t } = useSiteTranslation()
return <NumberMetaProperty name="min" label={t("MinProperty.label")} />
}
7 changes: 7 additions & 0 deletions src/components/designer/properties/MultilineProperty.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { useSiteTranslation } from "~/hooks/useSiteTranslation"
import { BooleanMetaProperty } from "./BooleanMetaProperty"

export const MultilineProperty = () => {
const { t } = useSiteTranslation()
return <BooleanMetaProperty name="multiline" label={t("MultilineProperty.label")} />
}
7 changes: 7 additions & 0 deletions src/components/designer/properties/NumberDefaultProperty.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { useSiteTranslation } from "~/hooks/useSiteTranslation"
import { NumberMetaProperty } from "./NumberMetaProperty"

export const NumberDefaultProperty = () => {
const { t } = useSiteTranslation()
return <NumberMetaProperty name="default" label={t("NumberDefaultProperty.label")} />
}
16 changes: 16 additions & 0 deletions src/components/designer/properties/NumberMetaProperty.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { NumberInput } from "@mantine/core"
import { Controller } from "react-hook-form"

interface NumberMetaPropertyProps {
name: string
label: string
}

export const NumberMetaProperty = ({ name, label }: NumberMetaPropertyProps) => (
<Controller
name={name}
render={({ field: { value, onChange }, fieldState: { error } }) => (
<NumberInput label={label} value={value} onChange={onChange} error={error?.message} />
)}
/>
)
Loading

0 comments on commit 758cc5e

Please sign in to comment.