Skip to content

Commit 7ad85ac

Browse files
committed
move everything to joins page, update search/default page, etc
1 parent 17d47b7 commit 7ad85ac

File tree

11 files changed

+132
-80
lines changed

11 files changed

+132
-80
lines changed

frontend/src/lib/components/NavigationBar/NavigationBar.svelte

Lines changed: 28 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,13 @@
2929
AdjustmentsHorizontal,
3030
ArrowsUpDown
3131
} from 'svelte-hero-icons';
32-
import type { IconSource } from 'svelte-hero-icons';
3332
import { goto } from '$app/navigation';
3433
import { isMacOS } from '$lib/util/browser';
3534
import { Badge } from '$lib/components/ui/badge';
35+
import { getEntity, type Entity } from '$lib/types/Entity/Entity';
3636
3737
type Props = {
38-
navItems: { label: string; href: string; icon: IconSource }[];
38+
navItems: Entity[];
3939
user: { name: string; avatar: string };
4040
};
4141
@@ -129,16 +129,16 @@
129129
{#each navItems as item}
130130
<li>
131131
<Button
132-
variant={isActiveRoute(item.href) ? 'default' : 'ghost'}
132+
variant={isActiveRoute(item.path) ? 'default' : 'ghost'}
133133
size="nav"
134-
href={item.href}
134+
href={item.path}
135135
icon="leading"
136136
>
137137
<Icon
138138
src={item.icon}
139139
micro
140140
size="16"
141-
class={isActiveRoute(item.href) ? 'text-muted-icon-primary' : 'text-muted-icon-neutral'}
141+
class={isActiveRoute(item.path) ? 'text-muted-icon-primary' : 'text-muted-icon-neutral'}
142142
/>
143143
{item.label}
144144
</Button>
@@ -200,9 +200,31 @@
200200
{:else}
201201
<CommandGroup heading={`Search for "${input}"`}>
202202
{#each searchResults as model}
203-
<CommandItem onSelect={() => handleSelect(`/models/${encodeURIComponent(model.name)}`)}>
203+
<CommandItem
204+
disabled
205+
onSelect={() =>
206+
handleSelect(`${getEntity('models').path}/${encodeURIComponent(model.name)}`)}
207+
>
208+
<Icon src={getEntity('models').icon} micro size="16" />
204209
{model.name}
205210
</CommandItem>
211+
<CommandItem
212+
onSelect={() =>
213+
handleSelect(`${getEntity('joins').path}/${encodeURIComponent(model.join.name)}`)}
214+
>
215+
<Icon src={getEntity('joins').icon} micro size="16" />
216+
{model.join.name}
217+
</CommandItem>
218+
{#each model.join.groupBys as groupBy}
219+
<CommandItem
220+
disabled
221+
onSelect={() =>
222+
handleSelect(`${getEntity('groupbys').path}/${encodeURIComponent(groupBy.name)}`)}
223+
>
224+
<Icon src={getEntity('groupbys').icon} micro size="16" />
225+
{groupBy.name}
226+
</CommandItem>
227+
{/each}
206228
{/each}
207229
</CommandGroup>
208230
{/if}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
import { Cube, PuzzlePiece, Square3Stack3d } from 'svelte-hero-icons';
2+
3+
export const entityConfig = [
4+
{
5+
label: 'Models',
6+
path: '/models',
7+
icon: Cube,
8+
id: 'models'
9+
},
10+
{
11+
label: 'GroupBys',
12+
path: '/groupbys',
13+
icon: PuzzlePiece,
14+
id: 'groupbys'
15+
},
16+
{
17+
label: 'Joins',
18+
path: '/joins',
19+
icon: Square3Stack3d,
20+
id: 'joins'
21+
}
22+
] as const;
23+
24+
export type Entity = (typeof entityConfig)[number];
25+
export type EntityId = Entity['id'];
26+
27+
// Helper function to get entity by ID
28+
export function getEntity(id: EntityId): Entity {
29+
const entity = entityConfig.find((entity) => entity.id === id);
30+
if (!entity) throw new Error(`Entity with id "${id}" not found`);
31+
return entity;
32+
}

frontend/src/lib/types/Model/Model.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ export type Model = {
44
production: boolean;
55
team: string;
66
modelType: string;
7-
join: JoinTimeSeriesResponse; // todo: this type needs to be updated to match the actual response once that WIP is finished
7+
join: Join;
88
};
99

1010
export type ModelsResponse = {
@@ -23,6 +23,16 @@ export type TimeSeriesResponse = {
2323
id: string;
2424
items: TimeSeriesItem[];
2525
};
26+
export type Join = {
27+
name: string;
28+
joinFeatures: string[];
29+
groupBys: GroupBy[];
30+
};
31+
32+
export type GroupBy = {
33+
name: string;
34+
features: string[];
35+
};
2636

2737
export type JoinTimeSeriesResponse = {
2838
name: string; // todo: rename to joinName

frontend/src/routes/+layout.svelte

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import NavigationBar from '$lib/components/NavigationBar/NavigationBar.svelte';
77
import BreadcrumbNav from '$lib/components/BreadcrumbNav/BreadcrumbNav.svelte';
88
import { ScrollArea } from '$lib/components/ui/scroll-area';
9-
import { Cube, PuzzlePiece, Square3Stack3d } from 'svelte-hero-icons';
9+
import { entityConfig } from '$lib/types/Entity/Entity';
1010
1111
let { children }: { children: Snippet } = $props();
1212
@@ -16,20 +16,14 @@
1616
avatar: '/path/to/avatar.jpg'
1717
};
1818
19-
const navItems = [
20-
{ label: 'Models', href: '/models', icon: Cube },
21-
{ label: 'GroupBys', href: '/groupbys', icon: PuzzlePiece },
22-
{ label: 'Joins', href: '/joins', icon: Square3Stack3d }
23-
];
24-
2519
const breadcrumbs = $derived($page.url.pathname.split('/').filter(Boolean));
2620
</script>
2721

2822
<div class="flex h-screen">
2923
<NavigationSlider />
3024

3125
<!-- Left navigation -->
32-
<NavigationBar {navItems} {user} />
26+
<NavigationBar navItems={entityConfig.filter((entity) => entity.id === 'joins')} {user} />
3327

3428
<!-- Main content -->
3529
<main

frontend/src/routes/+page.server.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@ import { redirect } from '@sveltejs/kit';
22

33
export function load({ url }) {
44
if (url.pathname === '/') {
5-
throw redirect(307, '/models');
5+
throw redirect(307, '/joins');
66
}
77
}

frontend/src/routes/groupbys/+page.svelte

Lines changed: 0 additions & 5 deletions
This file was deleted.
Lines changed: 58 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,60 @@
1-
<script>
2-
import ComingSoonPage from '$lib/components/ComingSoonPage/ComingSoonPage.svelte';
1+
<script lang="ts">
2+
import type { Model } from '$lib/types/Model/Model';
3+
import {
4+
Table,
5+
TableBody,
6+
TableCell,
7+
TableHead,
8+
TableHeader,
9+
TableRow
10+
} from '$lib/components/ui/table';
11+
import TrueFalseBadge from '$lib/components/TrueFalseBadge/TrueFalseBadge.svelte';
12+
import Separator from '$lib/components/ui/separator/separator.svelte';
13+
import PageHeader from '$lib/components/PageHeader/PageHeader.svelte';
14+
import ActionButtons from '$lib/components/ActionButtons/ActionButtons.svelte';
15+
16+
const { data } = $props();
17+
const models: Model[] = $state(data.models.items);
318
</script>
419

5-
<ComingSoonPage />
20+
<PageHeader title="Joins"></PageHeader>
21+
22+
<div class="w-full">
23+
<ActionButtons class="mb-4" />
24+
</div>
25+
<Separator fullWidthExtend={true} />
26+
<Table>
27+
<TableHeader>
28+
<TableRow>
29+
<TableHead>Join</TableHead>
30+
<TableHead>Model</TableHead>
31+
<TableHead>Team</TableHead>
32+
<TableHead>Type</TableHead>
33+
<TableHead>Online</TableHead>
34+
<TableHead>Production</TableHead>
35+
</TableRow>
36+
</TableHeader>
37+
<TableBody>
38+
{#each models as model}
39+
<TableRow>
40+
<TableCell>
41+
<a href="/joins/{model.join.name}" class="hover:underline">
42+
{model.join.name}
43+
</a>
44+
</TableCell>
45+
<TableCell>
46+
{model.name}
47+
</TableCell>
48+
<TableCell>{model.team}</TableCell>
49+
<TableCell>{model.modelType}</TableCell>
50+
<TableCell>
51+
<TrueFalseBadge isTrue={model.online} />
52+
</TableCell>
53+
<TableCell>
54+
<TrueFalseBadge isTrue={model.production} />
55+
</TableCell>
56+
</TableRow>
57+
{/each}
58+
</TableBody>
59+
</Table>
60+
<Separator fullWidthExtend={true} />

frontend/src/routes/models/+page.svelte

Lines changed: 0 additions & 56 deletions
This file was deleted.

0 commit comments

Comments
 (0)