Skip to content

Commit

Permalink
format
Browse files Browse the repository at this point in the history
  • Loading branch information
franciscoBSalgueiro committed May 22, 2024
1 parent 438dbcb commit a1883f3
Show file tree
Hide file tree
Showing 25 changed files with 922 additions and 796 deletions.
6 changes: 5 additions & 1 deletion src/components/Sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,11 @@ export function SideBar() {
</AppShellSection>
<AppShellSection>
<Stack justify="center" gap={0}>
<NavbarLink icon={IconSettings} label={t("SideBar.Settings")} url="/settings" />
<NavbarLink
icon={IconSettings}
label={t("SideBar.Settings")}
url="/settings"
/>
</Stack>
</AppShellSection>
</>
Expand Down
10 changes: 5 additions & 5 deletions src/components/boards/BoardAnalysis.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -173,32 +173,32 @@ function BoardAnalysis() {
value="practice"
leftSection={<IconTargetArrow size="1rem" />}
>
{ t("Board.Tabs.Practice") }
{t("Board.Tabs.Practice")}
</Tabs.Tab>
)}
<Tabs.Tab
value="analysis"
leftSection={<IconZoomCheck size="1rem" />}
>
{ t("Board.Tabs.Analysis") }
{t("Board.Tabs.Analysis")}
</Tabs.Tab>
<Tabs.Tab
value="database"
leftSection={<IconDatabase size="1rem" />}
>
{ t("Board.Tabs.Database") }
{t("Board.Tabs.Database")}
</Tabs.Tab>
<Tabs.Tab
value="annotate"
leftSection={<IconNotes size="1rem" />}
>
{ t("Board.Tabs.Annotate") }
{t("Board.Tabs.Annotate")}
</Tabs.Tab>
<Tabs.Tab
value="info"
leftSection={<IconInfoCircle size="1rem" />}
>
{ t("Board.Tabs.Info") }
{t("Board.Tabs.Info")}
</Tabs.Tab>
</Tabs.List>
{isRepertoire && (
Expand Down
4 changes: 2 additions & 2 deletions src/components/common/ConfirmModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ function ConfirmModal({
{title}
</Text>
<Text>{description}</Text>
<Text>{ t("Common.CannotUndo") }</Text>
<Text>{t("Common.CannotUndo")}</Text>
</div>

<Group justify="right">
<Button variant="default" onClick={() => onClose()}>
{ t("Common.Cancel") }
{t("Common.Cancel")}
</Button>
<Button color="red" onClick={() => onConfirm()}>
{confirmLabel || t("Common.Delete")}
Expand Down
4 changes: 3 additions & 1 deletion src/components/common/EvalChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,9 @@ function EvalChart(props: EvalChartProps) {
function getEvalText(node: TreeNode, type: "cp" | "wdl"): string {
if (node.score) {
if (type === "cp") {
return `${t("Board.Analysis.Advantage")}: ${formatScore(node.score.value)}`;
return `${t("Board.Analysis.Advantage")}: ${formatScore(
node.score.value,
)}`;
}
if (type === "wdl" && node.score.wdl) {
return `
Expand Down
2 changes: 1 addition & 1 deletion src/components/common/OpenFolderButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ function OpenFolderButton({
open(dir);
}
return (
<Tooltip label={ t("Common.OpenFolder") }>
<Tooltip label={t("Common.OpenFolder")}>
<ActionIcon onClick={() => openAppDirData()}>
<IconFolder size="1.5rem" />
</ActionIcon>
Expand Down
10 changes: 5 additions & 5 deletions src/components/databases/AddDatabase.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@ function AddDatabase({
>
<Tabs defaultValue="web">
<Tabs.List>
<Tabs.Tab value="web">{ t("Databases.Add.Web") }</Tabs.Tab>
<Tabs.Tab value="local">{ t("Common.Local") }</Tabs.Tab>
<Tabs.Tab value="web">{t("Databases.Add.Web")}</Tabs.Tab>
<Tabs.Tab value="local">{t("Common.Local")}</Tabs.Tab>
</Tabs.List>
<Tabs.Panel value="web" pt="xs">
{isLoading && (
Expand Down Expand Up @@ -223,19 +223,19 @@ function DatabaseCard({
<Group wrap="nowrap" grow my="md">
<Stack gap={0} align="center">
<Text tt="uppercase" c="dimmed" fw={700} size="xs">
{ t("Common.Size") }
{t("Common.Size")}
</Text>
<Text size="xs">{formatBytes(database.storage_size ?? 0)}</Text>
</Stack>
<Stack gap={0} align="center">
<Text tt="uppercase" c="dimmed" fw={700} size="xs">
{ t("Databases.Card.Games") }
{t("Databases.Card.Games")}
</Text>
<Text size="xs">{formatNumber(database.game_count)}</Text>
</Stack>
<Stack gap={0} align="center">
<Text tt="uppercase" c="dimmed" fw={700} size="xs">
{ t("Databases.Card.Players") }
{t("Databases.Card.Players")}
</Text>
<Text size="xs">{formatNumber(database.player_count)}</Text>
</Stack>
Expand Down
2 changes: 1 addition & 1 deletion src/components/databases/ConvertButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ function ConvertButton({
onClick={() => setOpen(true)}
>
<Stack gap={0} justify="center" w="100%" h="100%">
<Text mb={10}>{ t("Common.AddNew") }</Text>
<Text mb={10}>{t("Common.AddNew")}</Text>
<Box>
{loading ? (
<Loader variant="dots" size="1.3rem" />
Expand Down
51 changes: 28 additions & 23 deletions src/components/databases/DatabasesPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ export default function DatabasesPage() {
/>

<Group align="baseline" pl="lg" py="sm">
<Title>{ t("Databases.Title") }</Title>
<Title>{t("Databases.Title")}</Title>
<OpenFolderButton base="AppDir" folder="db" />
</Group>

Expand Down Expand Up @@ -204,7 +204,10 @@ export default function DatabasesPage() {
</>
) : (
<>
<Divider variant="dashed" label={t("Common.GeneralSettings")} />
<Divider
variant="dashed"
label={t("Common.GeneralSettings")}
/>
<GeneralSettings
key={selectedDatabase.filename}
selectedDatabase={selectedDatabase}
Expand All @@ -227,23 +230,23 @@ export default function DatabasesPage() {
<Group grow>
<Stack gap={0} justify="center" ta="center">
<Text size="md" tt="uppercase" fw="bold" c="dimmed">
{ t("Databases.Card.Games") }
{t("Databases.Card.Games")}
</Text>
<Text fw={700} size="lg">
{formatNumber(selectedDatabase.game_count)}
</Text>
</Stack>
<Stack gap={0} justify="center" ta="center">
<Text size="md" tt="uppercase" fw="bold" c="dimmed">
{ t("Databases.Card.Players") }
{t("Databases.Card.Players")}
</Text>
<Text fw={700} size="lg">
{formatNumber(selectedDatabase.player_count)}
</Text>
</Stack>
<Stack gap={0} justify="center" ta="center">
<Text size="md" tt="uppercase" fw="bold" c="dimmed">
{ t("Databases.Settings.Events") }
{t("Databases.Settings.Events")}
</Text>
<Text fw={700} size="lg">
{formatNumber(selectedDatabase.event_count)}
Expand All @@ -263,14 +266,17 @@ export default function DatabasesPage() {
size="lg"
rightSection={<IconArrowRight size="1rem" />}
>
{ t("Databases.Settings.Explore") }
{t("Databases.Settings.Explore")}
</Button>
)}
</div>
</>
)}

<Divider variant="dashed" label={t("Databases.Settings.AdvancedTools")} />
<Divider
variant="dashed"
label={t("Databases.Settings.AdvancedTools")}
/>

{!selectedDatabase.error && (
<AdvancedSettings
Expand All @@ -279,7 +285,10 @@ export default function DatabasesPage() {
/>
)}

<Divider variant="dashed" label={t("Databases.Settings.Actions")} />
<Divider
variant="dashed"
label={t("Databases.Settings.Actions")}
/>
<Group justify="space-between">
{!selectedDatabase.error && (
<Group>
Expand All @@ -303,7 +312,7 @@ export default function DatabasesPage() {
setConvertLoading(false);
}}
>
{ t("Databases.Settings.AddGames") }
{t("Databases.Settings.AddGames")}
</Button>
<Button
rightSection={<IconArrowRight size="1rem" />}
Expand All @@ -322,12 +331,12 @@ export default function DatabasesPage() {
setExportLoading(false);
}}
>
{ t("Databases.Settings.ExportPGN") }
{t("Databases.Settings.ExportPGN")}
</Button>
</Group>
)}
<Button onClick={() => toggleDeleteModal()} color="red">
{ t("Common.Delete") }
{t("Common.Delete")}
</Button>
</Group>
</Stack>
Expand All @@ -346,7 +355,7 @@ function GeneralSettings({
selectedDatabase: DatabaseInfo;
mutate: () => void;
}) {
const { t } = useTranslation()
const { t } = useTranslation();

const [title, setTitle] = useState(selectedDatabase.title);
const [description, setDescription] = useState(selectedDatabase.description);
Expand Down Expand Up @@ -422,11 +431,9 @@ function PlayerMerger({
return (
<Stack>
<Text fz="lg" fw="bold">
{ t("Databases.Settings.MergePlayers") }
</Text>
<Text fz="sm">
{ t("Databases.Settings.MergePlayers.Desc") }
{t("Databases.Settings.MergePlayers")}
</Text>
<Text fz="sm">{t("Databases.Settings.MergePlayers.Desc")}</Text>
<Group grow>
<PlayerSearchInput
label="Player 1"
Expand All @@ -438,7 +445,7 @@ function PlayerMerger({
onClick={mergePlayers}
rightSection={<IconArrowRight size="1rem" />}
>
{ t("Databases.Settings.Merge") }
{t("Databases.Settings.Merge")}
</Button>
<PlayerSearchInput
label="Player 2"
Expand All @@ -463,11 +470,9 @@ function DuplicateRemover({
return (
<Stack>
<Text fz="lg" fw="bold">
{ t("Databases.Settings.BatchDelete") }
</Text>
<Text fz="sm">
{ t("Databases.Settings.BatchDelete.Desc") }
{t("Databases.Settings.BatchDelete")}
</Text>
<Text fz="sm">{t("Databases.Settings.BatchDelete.Desc")}</Text>
<Group>
<Button
loading={loading}
Expand All @@ -484,7 +489,7 @@ function DuplicateRemover({
});
}}
>
{ t("Databases.Settings.RemoveDup") }
{t("Databases.Settings.RemoveDup")}
</Button>

<Button
Expand All @@ -502,7 +507,7 @@ function DuplicateRemover({
});
}}
>
{ t("Databases.Settings.RemoveEmpty") }
{t("Databases.Settings.RemoveEmpty")}
</Button>
</Group>
</Stack>
Expand Down
23 changes: 14 additions & 9 deletions src/components/engines/AddEngine.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@ function AddEngine({
validate: {
name: (value) => {
if (!value) return t("Common.RequireName");
if (engines.find((e) => e.name === value)) return t("Common.NameAlreadyUsed");
if (engines.find((e) => e.name === value))
return t("Common.NameAlreadyUsed");
},
path: (value) => {
if (!value) return t("Common.RequirePath");
Expand All @@ -73,12 +74,16 @@ function AddEngine({
});

return (
<Modal opened={opened} onClose={() => setOpened(false)} title={ t("Engines.Add.Title") }>
<Modal
opened={opened}
onClose={() => setOpened(false)}
title={t("Engines.Add.Title")}
>
<Tabs defaultValue="download">
<Tabs.List>
<Tabs.Tab value="download">{ t("Common.Download") }</Tabs.Tab>
<Tabs.Tab value="cloud">{ t("Engines.Add.Cloud") }</Tabs.Tab>
<Tabs.Tab value="local">{ t("Common.Local") }</Tabs.Tab>
<Tabs.Tab value="download">{t("Common.Download")}</Tabs.Tab>
<Tabs.Tab value="cloud">{t("Engines.Add.Cloud")}</Tabs.Tab>
<Tabs.Tab value="local">{t("Common.Local")}</Tabs.Tab>
</Tabs.List>
<Tabs.Panel value="download" pt="xs">
{isLoading && (
Expand All @@ -99,10 +104,10 @@ function AddEngine({
{error && (
<Alert
icon={<IconAlertCircle size="1rem" />}
title={ t("Common.Error") }
title={t("Common.Error")}
color="red"
>
{ t("Engines.Add.ErrorFetch") }
{t("Engines.Add.ErrorFetch")}
</Alert>
)}
</Stack>
Expand All @@ -128,7 +133,7 @@ function AddEngine({
</Tabs.Panel>
<Tabs.Panel value="local" pt="xs">
<EngineForm
submitLabel={ t("Common.Add") }
submitLabel={t("Common.Add")}
form={form}
onSubmit={(values: LocalEngine) => {
setEngines(async (prev) => [...(await prev), values]);
Expand Down Expand Up @@ -176,7 +181,7 @@ function CloudCard({ engine }: { engine: RemoteEngine }) {
]);
}}
>
{ t("Common.Add") }
{t("Common.Add")}
</Button>
</Box>
</Group>
Expand Down
2 changes: 1 addition & 1 deletion src/components/engines/EditEngine.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export default function EditEngine({

return (
<EngineForm
submitLabel={ t("Common.Save") }
submitLabel={t("Common.Save")}
form={form}
onSubmit={(values) => {
setEngines(async (prev) =>
Expand Down
Loading

0 comments on commit a1883f3

Please sign in to comment.