Skip to content

Commit

Permalink
fix scroll bars in modals (#34)
Browse files Browse the repository at this point in the history
  • Loading branch information
franciscoBSalgueiro authored Oct 8, 2023
1 parent 9f49c15 commit fabdb63
Show file tree
Hide file tree
Showing 4 changed files with 69 additions and 71 deletions.
45 changes: 23 additions & 22 deletions src/components/databases/AddDatabase.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@ function AddDatabase({
opened={opened}
onClose={() => setOpened(false)}
title="Add Database"
scrollAreaComponent={ScrollArea.Autosize}
>
<Tabs defaultValue="web">
<Tabs.List>
Expand All @@ -107,27 +106,29 @@ function AddDatabase({
<Loader />
</Center>
)}
<Stack>
{defaultDatabases &&
defaultDatabases.map((db, i) => (
<DatabaseCard
database={db}
databaseId={i}
key={i}
setDatabases={setDatabases}
initInstalled={databases.some((e) => e.title === db.title)}
/>
))}
{error && (
<Alert
icon={<IconAlertCircle size="1rem" />}
title="Error"
color="red"
>
{"Failed to fetch the database's info from the server."}
</Alert>
)}
</Stack>
<ScrollArea.Autosize h={500} offsetScrollbars>
<Stack>
{defaultDatabases &&
defaultDatabases.map((db, i) => (
<DatabaseCard
database={db}
databaseId={i}
key={i}
setDatabases={setDatabases}
initInstalled={databases.some((e) => e.title === db.title)}
/>
))}
{error && (
<Alert
icon={<IconAlertCircle size="1rem" />}
title="Error"
color="red"
>
{"Failed to fetch the database's info from the server."}
</Alert>
)}
</Stack>
</ScrollArea.Autosize>
</Tabs.Panel>
<Tabs.Panel value="local" pt="xs">
<form
Expand Down
51 changes: 24 additions & 27 deletions src/components/engines/AddEngine.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -87,12 +87,7 @@ function AddEngine({
});

return (
<Modal
opened={opened}
onClose={() => setOpened(false)}
title="Add Engine"
scrollAreaComponent={ScrollArea.Autosize}
>
<Modal opened={opened} onClose={() => setOpened(false)} title="Add Engine">
<Tabs defaultValue="web">
<Tabs.List>
<Tabs.Tab value="web">Web</Tabs.Tab>
Expand All @@ -104,27 +99,29 @@ function AddEngine({
<Loader />
</Center>
)}
<Stack>
{defaultEngines &&
defaultEngines.map((engine, i) => (
<EngineCard
engine={engine}
engineId={i}
key={i}
setEngines={setEngines}
initInstalled={engines.some((e) => e.name === engine.name)}
/>
))}
{error && (
<Alert
icon={<IconAlertCircle size="1rem" />}
title="Error"
color="red"
>
{"Failed to fetch the engine's info from the server."}
</Alert>
)}
</Stack>
<ScrollArea.Autosize mah={500} offsetScrollbars>
<Stack>
{defaultEngines &&
defaultEngines.map((engine, i) => (
<EngineCard
engine={engine}
engineId={i}
key={i}
setEngines={setEngines}
initInstalled={engines.some((e) => e.name === engine.name)}
/>
))}
{error && (
<Alert
icon={<IconAlertCircle size="1rem" />}
title="Error"
color="red"
>
{"Failed to fetch the engine's info from the server."}
</Alert>
)}
</Stack>
</ScrollArea.Autosize>
</Tabs.Panel>
<Tabs.Panel value="local" pt="xs">
<EngineForm
Expand Down
1 change: 0 additions & 1 deletion src/components/engines/EditEngine.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ export default function EditEngine({
opened={opened}
onClose={() => setOpened(false)}
title="Edit Engine"
scrollAreaComponent={ScrollArea.Autosize}
>
<EngineForm
submitLabel="Save"
Expand Down
43 changes: 22 additions & 21 deletions src/components/puzzles/AddPuzzle.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,28 +66,29 @@ function AddPuzzle({
opened={opened}
onClose={() => setOpened(false)}
title="Add Database"
scrollAreaComponent={ScrollArea.Autosize}
>
<Stack>
{defaultdatabases.map((db, i) => (
<PuzzleDbCard
puzzleDb={db}
databaseId={i}
key={i}
setPuzzleDbs={setPuzzleDbs}
initInstalled={puzzleDbs.some((e) => e.title === db.title)}
/>
))}
{error && (
<Alert
icon={<IconAlertCircle size="1rem" />}
title="Error"
color="red"
>
{"Failed to fetch the database's info from the server."}
</Alert>
)}
</Stack>
<ScrollArea.Autosize mah={500} offsetScrollbars>
<Stack>
{defaultdatabases.map((db, i) => (
<PuzzleDbCard
puzzleDb={db}
databaseId={i}
key={i}
setPuzzleDbs={setPuzzleDbs}
initInstalled={puzzleDbs.some((e) => e.title === db.title)}
/>
))}
{error && (
<Alert
icon={<IconAlertCircle size="1rem" />}
title="Error"
color="red"
>
{"Failed to fetch the database's info from the server."}
</Alert>
)}
</Stack>
</ScrollArea.Autosize>
</Modal>
);
}
Expand Down

0 comments on commit fabdb63

Please sign in to comment.