fix(extra) : show text colors and catalog items
This commit is contained in:
@@ -269,6 +269,7 @@ type TeamValue = {
|
||||
|
||||
let clientIdCounter = 0;
|
||||
const DEFAULT_EXTRA_BACKGROUND_COLOR = "#24232C";
|
||||
const DEFAULT_EXTRA_TEXT_COLOR = "#FAFAFA";
|
||||
const RichTextEditor = dynamic(
|
||||
() => import("@/components/rich-text-editor").then((module) => module.RichTextEditor),
|
||||
{
|
||||
@@ -329,6 +330,7 @@ export interface GuideSectionEditorProps {
|
||||
body: string;
|
||||
percent: string | null;
|
||||
backgroundColor: string | null;
|
||||
textColor: string | null;
|
||||
catalogItems: ExtraCatalogItem[];
|
||||
highlights: Array<{ text: string; color: string }>;
|
||||
imageUrl: string | null;
|
||||
@@ -3423,6 +3425,7 @@ function ExtraEditor({ guide, initial, characters, weapons, artifacts }: EditorB
|
||||
? null
|
||||
: Number(row.percent),
|
||||
backgroundColor: row.backgroundColor,
|
||||
textColor: row.textColor,
|
||||
catalogItems: row.catalogItems,
|
||||
highlights: [],
|
||||
})),
|
||||
@@ -3455,6 +3458,7 @@ function ExtraEditor({ guide, initial, characters, weapons, artifacts }: EditorB
|
||||
id: row.id || createClientId("extra-row-record"),
|
||||
body: normalizeExtraRichText(row.body, row.highlights ?? []),
|
||||
backgroundColor: row.backgroundColor ?? null,
|
||||
textColor: row.textColor ?? null,
|
||||
catalogItems: row.catalogItems ?? [],
|
||||
highlights: [],
|
||||
clientId: row.clientId || createClientId("extra-row"),
|
||||
@@ -3850,7 +3854,7 @@ function ExtraEditor({ guide, initial, characters, weapons, artifacts }: EditorB
|
||||
/>
|
||||
</Field>
|
||||
<FieldSet>
|
||||
<FieldLegend>สีพื้นหลังการ์ด (optional)</FieldLegend>
|
||||
<FieldLegend>สีการ์ด (optional)</FieldLegend>
|
||||
<FieldDescription>
|
||||
สีจะใช้เฉพาะการ์ดนี้บนหน้า Guide
|
||||
</FieldDescription>
|
||||
@@ -3917,6 +3921,69 @@ function ExtraEditor({ guide, initial, characters, weapons, artifacts }: EditorB
|
||||
<RefreshCcwIcon data-icon="inline-start" />
|
||||
ใช้สีตามธีม
|
||||
</Button>
|
||||
<Field
|
||||
data-invalid={extraIssue(
|
||||
"sections",
|
||||
sectionIndex,
|
||||
"rows",
|
||||
rowIndex,
|
||||
"textColor",
|
||||
) || undefined}
|
||||
>
|
||||
<FieldLabel>สีข้อความ</FieldLabel>
|
||||
<Input
|
||||
type="color"
|
||||
value={row.textColor ?? DEFAULT_EXTRA_TEXT_COLOR}
|
||||
aria-invalid={extraIssue(
|
||||
"sections",
|
||||
sectionIndex,
|
||||
"rows",
|
||||
rowIndex,
|
||||
"textColor",
|
||||
)}
|
||||
onChange={(event) =>
|
||||
setSections(
|
||||
sections.map((item, index) =>
|
||||
index === sectionIndex
|
||||
? {
|
||||
...item,
|
||||
rows: item.rows.map((candidate, inner) =>
|
||||
inner === rowIndex
|
||||
? { ...candidate, textColor: event.target.value }
|
||||
: candidate,
|
||||
),
|
||||
}
|
||||
: item,
|
||||
),
|
||||
)
|
||||
}
|
||||
/>
|
||||
</Field>
|
||||
<Button
|
||||
type="button"
|
||||
variant="outline"
|
||||
size="sm"
|
||||
disabled={row.textColor === null}
|
||||
onClick={() =>
|
||||
setSections(
|
||||
sections.map((item, index) =>
|
||||
index === sectionIndex
|
||||
? {
|
||||
...item,
|
||||
rows: item.rows.map((candidate, inner) =>
|
||||
inner === rowIndex
|
||||
? { ...candidate, textColor: null }
|
||||
: candidate,
|
||||
),
|
||||
}
|
||||
: item,
|
||||
),
|
||||
)
|
||||
}
|
||||
>
|
||||
<RefreshCcwIcon data-icon="inline-start" />
|
||||
ใช้สีข้อความตามธีม
|
||||
</Button>
|
||||
</FieldSet>
|
||||
</FieldGroup>
|
||||
</CardContent>
|
||||
@@ -3947,6 +4014,7 @@ function ExtraEditor({ guide, initial, characters, weapons, artifacts }: EditorB
|
||||
body: "",
|
||||
percent: null,
|
||||
backgroundColor: null,
|
||||
textColor: null,
|
||||
catalogItems: [],
|
||||
highlights: [],
|
||||
clientId: createClientId("extra-row"),
|
||||
|
||||
Reference in New Issue
Block a user