mirror of
https://github.com/appwrite/console.git
synced 2026-06-06 19:27:48 +00:00
Remove artifacts from breadcrumbs and fix mobile menu accordingly
This commit is contained in:
@@ -78,13 +78,9 @@
|
||||
) as Artifact[];
|
||||
$: selectedOrg = organizations.find((organization) => organization.isSelected);
|
||||
$: selectedProject = selectedOrg?.projects.find((project) => project.isSelected);
|
||||
$: selectedArtifact = displayArtifacts.find(
|
||||
(artifact) => $page.params.artifact === artifact.$id
|
||||
) as Artifact;
|
||||
|
||||
let organisationBottomSheetOpen = false;
|
||||
let projectsBottomSheetOpen = false;
|
||||
let artifactsBottomSheetOpen = false;
|
||||
|
||||
function createOrg() {
|
||||
trackEvent(Click.OrganizationClickCreate, { source: 'breadcrumbs' });
|
||||
@@ -192,54 +188,6 @@
|
||||
: undefined
|
||||
};
|
||||
|
||||
let artifactsBottomSheet: SheetMenu;
|
||||
$: artifactsBottomSheet = {
|
||||
top:
|
||||
displayArtifacts.length > 1
|
||||
? {
|
||||
title: 'Switch artifact',
|
||||
items: !selectedOrg
|
||||
? []
|
||||
: displayArtifacts
|
||||
.map((artifact, index) => {
|
||||
if (index < 4) {
|
||||
return {
|
||||
name: artifact.name,
|
||||
href: `${base}/project-${selectedProject.$id}/studio/artifact-${artifact.$id}`
|
||||
};
|
||||
} else if (index === 4) {
|
||||
return {
|
||||
name: 'All artifacts',
|
||||
href: `${base}/project-${selectedProject.$id}/studio`
|
||||
};
|
||||
}
|
||||
return null;
|
||||
})
|
||||
.filter((project) => project !== null)
|
||||
}
|
||||
: {
|
||||
items: [
|
||||
{
|
||||
name: 'Create project',
|
||||
trailingIcon: IconPlus,
|
||||
href: `${base}/organization-${selectedOrg?.$id}?create-project`
|
||||
}
|
||||
]
|
||||
},
|
||||
bottom:
|
||||
selectedOrg?.projects.length > 1
|
||||
? {
|
||||
items: [
|
||||
{
|
||||
name: 'Create project',
|
||||
trailingIcon: IconPlus,
|
||||
href: `${base}/organization-${selectedOrg?.$id}?create-project`
|
||||
}
|
||||
]
|
||||
}
|
||||
: undefined
|
||||
};
|
||||
|
||||
function onResize() {
|
||||
if ((organisationBottomSheetOpen || projectsBottomSheetOpen) && !$isSmallViewport) {
|
||||
organisationBottomSheetOpen = false;
|
||||
@@ -410,70 +358,11 @@
|
||||
</Card.Base>
|
||||
</div>
|
||||
{/if}
|
||||
{#if isStudio && displayArtifacts.length > 0 && selectedProject}
|
||||
<span class="breadcrumb-separator">/</span>
|
||||
{#if !$isSmallViewport}
|
||||
<button
|
||||
type="button"
|
||||
class="trigger"
|
||||
use:melt={$triggerArtifacts}
|
||||
aria-label="Open artifacts tab">
|
||||
<span class="projectName">{selectedArtifact?.name}</span>
|
||||
<Icon icon={IconChevronDown} size="s" />
|
||||
</button>
|
||||
{:else}
|
||||
<button
|
||||
type="button"
|
||||
class="trigger"
|
||||
on:click={() => (artifactsBottomSheetOpen = true)}
|
||||
aria-label="Open artifacts tab">
|
||||
<span class="projectName">{selectedArtifact.name}</span>
|
||||
<Icon icon={IconChevronDown} size="s" />
|
||||
</button>
|
||||
{/if}
|
||||
|
||||
<div class="menu" use:melt={$menuArtifacts}>
|
||||
<Card.Base padding="xxxs" shadow={true}>
|
||||
{#if displayArtifacts.length > 1}
|
||||
{#each displayArtifacts as artifact, index}
|
||||
{#if index < 4}
|
||||
<div use:melt={$itemArtifacts}>
|
||||
<ActionMenu.Root>
|
||||
<ActionMenu.Item.Anchor
|
||||
href={`${base}/project-${selectedProject.$id}/studio/artifact-${artifact.$id}`}
|
||||
>{artifact.name}</ActionMenu.Item.Anchor
|
||||
></ActionMenu.Root>
|
||||
</div>
|
||||
{:else if index === 4}
|
||||
<div use:melt={$itemArtifacts}>
|
||||
<ActionMenu.Root>
|
||||
<ActionMenu.Item.Anchor
|
||||
href={`${base}/project-${selectedProject.$id}/studio`}
|
||||
>All artifacts</ActionMenu.Item.Anchor
|
||||
></ActionMenu.Root>
|
||||
</div>
|
||||
{/if}
|
||||
{/each}
|
||||
<div class="separator" use:melt={$separatorArtifacts}></div>
|
||||
{/if}
|
||||
<div use:melt={$itemArtifacts}>
|
||||
<ActionMenu.Root>
|
||||
<ActionMenu.Item.Anchor
|
||||
leadingIcon={IconPlusSm}
|
||||
href={`${base}/project-${selectedProject.$id}/studio?create-project`}
|
||||
>Create artifact</ActionMenu.Item.Anchor
|
||||
></ActionMenu.Root>
|
||||
</div>
|
||||
</Card.Base>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
<BottomSheet.Menu bind:isOpen={organisationBottomSheetOpen} menu={organizationsBottomSheet}
|
||||
></BottomSheet.Menu>
|
||||
<BottomSheet.Menu bind:isOpen={projectsBottomSheetOpen} menu={projectsBottomSheet}
|
||||
></BottomSheet.Menu>
|
||||
<BottomSheet.Menu bind:isOpen={artifactsBottomSheetOpen} menu={artifactsBottomSheet}
|
||||
></BottomSheet.Menu>
|
||||
|
||||
<style lang="scss">
|
||||
.menu {
|
||||
|
||||
@@ -476,7 +476,7 @@
|
||||
|
||||
.studio-content {
|
||||
min-height: calc(100vh - 54px);
|
||||
margin-top: 54px;
|
||||
margin-top: 32px;
|
||||
width: 100vw;
|
||||
|
||||
padding-right: var(--space-4);
|
||||
@@ -485,6 +485,7 @@
|
||||
@media (min-width: 1024px) {
|
||||
width: calc(100vw - 200px);
|
||||
margin-left: 200px;
|
||||
margin-top: 54px;
|
||||
padding-left: 0;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user