-
Notifications
You must be signed in to change notification settings - Fork 117
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Add orgnaization tabs and settings tab skeleton #5458
Changes from 5 commits
2dbadda
d33da47
fea0389
fa29130
b767535
c8d084f
b710771
603fe9e
58bf866
a830d88
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
<script lang="ts"> | ||
import { page } from "$app/stores"; | ||
import LeftNavItem from "@rilldata/web-admin/components/nav/LeftNavItem.svelte"; | ||
|
||
export let title: string; | ||
export let basePage: string; | ||
export let baseRoute: string; | ||
export let navItems: { | ||
label: string; | ||
route: string; | ||
}[]; | ||
</script> | ||
|
||
<div class="nav-layout-container"> | ||
<h3>{title}</h3> | ||
<div class="nav-container"> | ||
<div class="nav-items"> | ||
{#each navItems as { label, route } (route)} | ||
<LeftNavItem | ||
{label} | ||
link={`${basePage}/${route}`} | ||
selected={$page.route.id === `${baseRoute}/${route}`} | ||
/> | ||
{/each} | ||
</div> | ||
<div><slot /></div> | ||
</div> | ||
</div> | ||
|
||
<style lang="postcss"> | ||
.nav-layout-container { | ||
@apply px-32 py-10; | ||
} | ||
|
||
h3 { | ||
@apply text-2xl font-semibold; | ||
} | ||
|
||
.nav-container { | ||
@apply flex flex-row pt-6 gap-x-6; | ||
} | ||
|
||
.nav-items { | ||
@apply flex flex-col gap-y-1; | ||
@apply min-w-[150px]; | ||
} | ||
</style> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<script lang="ts"> | ||
export let label: string; | ||
export let selected: boolean; | ||
export let link: string; | ||
</script> | ||
|
||
<a class:selected href={link}> | ||
{label} | ||
</a> | ||
|
||
<style lang="postcss"> | ||
a { | ||
@apply p-2 flex gap-x-1 items-center; | ||
@apply rounded-sm text-slate-900; | ||
@apply text-sm font-medium; | ||
} | ||
|
||
.selected { | ||
@apply bg-slate-100; | ||
} | ||
|
||
a:hover { | ||
@apply bg-slate-50; | ||
} | ||
</style> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
<script lang="ts"> | ||
import { page } from "$app/stores"; | ||
import { createAdminServiceGetOrganization } from "@rilldata/web-admin/client"; | ||
|
||
$: ({ | ||
url: { pathname }, | ||
params: { organization }, | ||
} = $page); | ||
|
||
// Get the list of tabs to display, depending on the user's permissions | ||
$: tabsQuery = createAdminServiceGetOrganization(organization, { | ||
query: { | ||
select: (data) => { | ||
let tabs = [ | ||
{ | ||
route: `/${organization}`, | ||
label: "Projects", | ||
}, | ||
]; | ||
|
||
if (data.permissions.manageOrgMembers) { | ||
// TODO: users page | ||
} | ||
|
||
if (data.permissions.manageOrg) { | ||
// TODO: once settings page is filled in we add these | ||
tabs.push({ | ||
route: `/${organization}/-/settings`, | ||
label: "Settings", | ||
}); | ||
} | ||
|
||
return tabs; | ||
}, | ||
}, | ||
}); | ||
|
||
$: tabs = $tabsQuery.data; | ||
</script> | ||
|
||
<!-- Hide the tabs when there is only one entry --> | ||
{#if tabs?.length && tabs?.length > 1} | ||
<nav> | ||
{#each tabs as tab (tab.route)} | ||
<a href={tab.route} class:selected={pathname === tab.route}> | ||
{tab.label} | ||
</a> | ||
{/each} | ||
</nav> | ||
{:else} | ||
<!-- Add a border to keep things consistent. It is cleaner to handle this here. --> | ||
<div class="border-b"></div> | ||
{/if} | ||
|
||
<style lang="postcss"> | ||
a { | ||
@apply p-2 flex gap-x-1 items-center; | ||
@apply rounded-sm text-gray-500; | ||
@apply text-xs font-medium justify-center; | ||
} | ||
|
||
.selected { | ||
@apply text-gray-900; | ||
} | ||
|
||
a:hover { | ||
@apply bg-slate-100 text-gray-700; | ||
} | ||
|
||
nav { | ||
@apply flex gap-x-6 px-[17px] border-b pt-1 pb-[3px]; | ||
} | ||
</style> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<script lang="ts"> | ||
import { page } from "$app/stores"; | ||
import LeftNav from "@rilldata/web-admin/components/nav/LeftNav.svelte"; | ||
|
||
$: organization = $page.params.organization; | ||
$: basePage = `/${organization}/-/settings`; | ||
|
||
const navItems = [ | ||
{ | ||
label: "General", | ||
route: "general", | ||
}, | ||
{ | ||
label: "Billing", | ||
route: "billing", | ||
}, | ||
{ | ||
label: "Usage", | ||
route: "usage", | ||
}, | ||
]; | ||
</script> | ||
|
||
<LeftNav | ||
title="Settings" | ||
{basePage} | ||
baseRoute="/[organization]/-/settings" | ||
{navItems} | ||
> | ||
<slot /> | ||
</LeftNav> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Rather than the main page content being a child of
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. With this approach, it'd also make sense to pull the "Settings" header out of the |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
<script lang="ts"> | ||
</script> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Coming soon |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Coming soon |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Coming soon |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo:
witin
->within