From 0bd5f6c6e855aa5d23a726be289e05e39c627846 Mon Sep 17 00:00:00 2001 From: Exelo Date: Sun, 7 Jun 2026 15:02:25 +0900 Subject: [PATCH 1/5] feat: add docs buttons in menu --- .env.example | 4 +- .github/workflows/release.yml | 4 + Dockerfile | 4 + src/lib/components/Menu/MenuBar.svelte | 110 ++++++++++++++++++------ src/lib/components/Menu/MenuItem.svelte | 27 ++++-- 5 files changed, 116 insertions(+), 33 deletions(-) diff --git a/.env.example b/.env.example index b5ac4cd..8cd609d 100644 --- a/.env.example +++ b/.env.example @@ -4,8 +4,10 @@ NODE_ENV=development # OFFLINE or ONLINE, change editor mode beetween local execution and online execution PUBLIC_MODE=OFFLINE -# Project Manager +# Urls PUBLIC_PM_URL=https://projects.nanoforge.eu +PUBLIC_DOCS_URL=https://docs.nanoforge.eu +PUBLIC_LANDING_URL=https://nanoforge.eu # Api params (required if PUBLIC_MODE=ONLINE) API_URL=http://localhost:3000 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 51a60b2..917248d 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -88,9 +88,13 @@ jobs: args: | PUBLIC_MODE PUBLIC_PM_URL + PUBLIC_DOCS_URL + PUBLIC_LANDING_URL env: PUBLIC_MODE: ONLINE PUBLIC_PM_URL: https://projects.nanoforge.eu + PUBLIC_DOCS_URL: https://docs.nanoforge.eu + PUBLIC_LANDING_URL: https://nanoforge.eu publish-docs: name: Publish docs diff --git a/Dockerfile b/Dockerfile index 6f563b7..bb2cd17 100644 --- a/Dockerfile +++ b/Dockerfile @@ -16,9 +16,13 @@ FROM base AS prod ARG PUBLIC_MODE ARG PUBLIC_PM_URL +ARG PUBLIC_DOCS_URL +ARG PUBLIC_LANDING_URL ENV PUBLIC_MODE=${PUBLIC_MODE} ENV PUBLIC_PM_URL=${PUBLIC_PM_URL} +ENV PUBLIC_DOCS_URL=${PUBLIC_DOCS_URL} +ENV PUBLIC_LANDING_URL=${PUBLIC_LANDING_URL} RUN pnpm install --frozen-lockfile COPY . /app diff --git a/src/lib/components/Menu/MenuBar.svelte b/src/lib/components/Menu/MenuBar.svelte index fa023b3..8dbf8be 100644 --- a/src/lib/components/Menu/MenuBar.svelte +++ b/src/lib/components/Menu/MenuBar.svelte @@ -3,9 +3,27 @@ import MenuItem from './MenuItem.svelte'; import { resolve } from '$app/paths'; import { goto } from '$app/navigation'; + import type { Snippet } from 'svelte'; + import { ProjectLoader } from '$lib/client/project'; + import { PUBLIC_DOCS_URL, PUBLIC_LANDING_URL } from '$env/static/public'; let fileInput: HTMLInputElement; + type MenuItem = { icon: string } & ( + | { + name: string; + } + | { + snippet: Snippet; + } + ) & + ({ onClick: () => void; link?: string } | { onClick?: () => void; link: string }); + + interface Menu { + name: string; + items: MenuItem[]; + } + async function handleImportClick() { fileInput.click(); } @@ -19,31 +37,75 @@ //await importFromZip(file); input.value = ''; } + + const nullFunction = () => {}; + + const elements: Menu[] = [ + { + name: 'File', + items: [ + { name: 'Save', icon: 'i-solar-cloud-download-bold-duotone', onClick: nullFunction }, + { + snippet: fileImportSnippet, + icon: 'i-solar-download-bold-duotone', + onClick: handleImportClick, + }, + { name: 'Export', icon: 'i-solar-file-send-bold-duotone', onClick: nullFunction }, + { + name: 'Exit', + icon: 'i-solar-exit-bold-duotone', + onClick: () => { + ProjectLoader.unload(); + goto(resolve('/')); + }, + }, + ], + }, + { + name: 'Edit', + items: [ + { name: 'Undo', icon: 'i-solar-arrow-left-bold-duotone', onClick: nullFunction }, + { name: 'Redo', icon: 'i-solar-arrow-right-bold-duotone', onClick: nullFunction }, + { name: 'Project settings', icon: 'i-solar-settings-bold-duotone', onClick: nullFunction }, + ], + }, + { + name: 'Help', + items: [ + { name: 'Documentation', icon: 'i-solar-book-2-bold-duotone', link: PUBLIC_DOCS_URL }, + { + name: 'About Us', + icon: 'i-solar-info-circle-bold-duotone', + link: `${PUBLIC_LANDING_URL}/about`, + }, + ], + }, + ]; +{#snippet fileImportSnippet()} + Import + +{/snippet} +
- - Save - - Import - - - Export - goto(resolve('/'))}>Exit - - - Undo - Redo - Project settings - - - Documentation - About Us - + {#each elements as menu (menu.name)} + + {#each menu.items as item, i (i)} + + {#if 'snippet' in item} + {@render item.snippet()} + {:else} + {item.name} + {/if} + + {/each} + + {/each}
diff --git a/src/lib/components/Menu/MenuItem.svelte b/src/lib/components/Menu/MenuItem.svelte index 360a8a8..246f2fc 100644 --- a/src/lib/components/Menu/MenuItem.svelte +++ b/src/lib/components/Menu/MenuItem.svelte @@ -4,20 +4,31 @@ interface Props { icon?: string; + link?: string; children?: Snippet; onClick?: () => void; } - let { icon, children, onClick }: Props = $props(); + let { icon, link, children, onClick }: Props = $props();
- + {#if link} + + + {@render children?.()} + + {:else} + + {/if}
From 34f24825fd66c4eae151812ae2d5eeca300ac1bc Mon Sep 17 00:00:00 2001 From: Exelo Date: Sun, 7 Jun 2026 15:08:15 +0900 Subject: [PATCH 2/5] ci: add new env to tests ci --- .github/workflows/tests.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index c91deaa..39a5030 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -11,6 +11,11 @@ on: jobs: tests: + env: + PUBLIC_MODE: ${{ vars.PUBLIC_MODE }} + PUBLIC_PM_URL: ${{ vars.PUBLIC_PM_URL }} + PUBLIC_DOCS_URL: ${{ vars.PUBLIC_DOCS_URL }} + PUBLIC_LANDING_URL: ${{ vars.PUBLIC_LANDING_URL }} runs-on: ubuntu-latest steps: - name: Checkout repository @@ -18,9 +23,6 @@ jobs: - name: Prepare uses: ./.github/actions/prepare - env: - PUBLIC_MODE: ${{ vars.PUBLIC_MODE }} - PUBLIC_PM_URL: ${{ vars.PUBLIC_PM_URL }} - name: Run linter run: pnpm lint From c827ea1df6736e82a5eac093ad8843643eb9d477 Mon Sep 17 00:00:00 2001 From: Exelo Date: Sun, 7 Jun 2026 15:16:54 +0900 Subject: [PATCH 3/5] ci: fix env issue --- .github/workflows/alpha-release.yml | 6 ++++++ .github/workflows/pre-release.yml | 6 ++++++ .github/workflows/release.yml | 10 +++++----- .github/workflows/tests.yml | 11 ++++++----- 4 files changed, 23 insertions(+), 10 deletions(-) diff --git a/.github/workflows/alpha-release.yml b/.github/workflows/alpha-release.yml index 31db1ed..4468744 100644 --- a/.github/workflows/alpha-release.yml +++ b/.github/workflows/alpha-release.yml @@ -8,6 +8,12 @@ on: type: boolean default: false +env: + PUBLIC_MODE: ${{ vars.PUBLIC_MODE }} + PUBLIC_PM_URL: ${{ vars.PUBLIC_PM_URL }} + PUBLIC_DOCS_URL: ${{ vars.PUBLIC_DOCS_URL }} + PUBLIC_LANDING_URL: ${{ vars.PUBLIC_LANDING_URL }} + permissions: contents: write id-token: write diff --git a/.github/workflows/pre-release.yml b/.github/workflows/pre-release.yml index 1911e35..425174a 100644 --- a/.github/workflows/pre-release.yml +++ b/.github/workflows/pre-release.yml @@ -12,6 +12,12 @@ on: type: boolean default: false +env: + PUBLIC_MODE: ${{ vars.PUBLIC_MODE }} + PUBLIC_PM_URL: ${{ vars.PUBLIC_PM_URL }} + PUBLIC_DOCS_URL: ${{ vars.PUBLIC_DOCS_URL }} + PUBLIC_LANDING_URL: ${{ vars.PUBLIC_LANDING_URL }} + permissions: contents: write pull-requests: write diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 917248d..684de19 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -13,6 +13,11 @@ env: IMAGE_NAME: ${{ github.event.repository.name }} CONFIG_FILE: kubernetes/nanoforge/editor-override.yaml + PUBLIC_MODE: ONLINE + PUBLIC_PM_URL: https://projects.nanoforge.eu + PUBLIC_DOCS_URL: https://docs.nanoforge.eu + PUBLIC_LANDING_URL: https://nanoforge.eu + permissions: contents: write packages: write @@ -90,11 +95,6 @@ jobs: PUBLIC_PM_URL PUBLIC_DOCS_URL PUBLIC_LANDING_URL - env: - PUBLIC_MODE: ONLINE - PUBLIC_PM_URL: https://projects.nanoforge.eu - PUBLIC_DOCS_URL: https://docs.nanoforge.eu - PUBLIC_LANDING_URL: https://nanoforge.eu publish-docs: name: Publish docs diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 39a5030..d604417 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -9,13 +9,14 @@ on: - main workflow_dispatch: +env: + PUBLIC_MODE: ${{ vars.PUBLIC_MODE }} + PUBLIC_PM_URL: ${{ vars.PUBLIC_PM_URL }} + PUBLIC_DOCS_URL: ${{ vars.PUBLIC_DOCS_URL }} + PUBLIC_LANDING_URL: ${{ vars.PUBLIC_LANDING_URL }} + jobs: tests: - env: - PUBLIC_MODE: ${{ vars.PUBLIC_MODE }} - PUBLIC_PM_URL: ${{ vars.PUBLIC_PM_URL }} - PUBLIC_DOCS_URL: ${{ vars.PUBLIC_DOCS_URL }} - PUBLIC_LANDING_URL: ${{ vars.PUBLIC_LANDING_URL }} runs-on: ubuntu-latest steps: - name: Checkout repository From 918dbc18645918417c3fb06efb81be1edd202131 Mon Sep 17 00:00:00 2001 From: Exelo Date: Sun, 7 Jun 2026 15:22:48 +0900 Subject: [PATCH 4/5] ci: fix env use vars at release ci --- .github/workflows/release.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 684de19..360d31b 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -13,10 +13,10 @@ env: IMAGE_NAME: ${{ github.event.repository.name }} CONFIG_FILE: kubernetes/nanoforge/editor-override.yaml - PUBLIC_MODE: ONLINE - PUBLIC_PM_URL: https://projects.nanoforge.eu - PUBLIC_DOCS_URL: https://docs.nanoforge.eu - PUBLIC_LANDING_URL: https://nanoforge.eu + PUBLIC_MODE: ${{ vars.PUBLIC_MODE }} + PUBLIC_PM_URL: ${{ vars.PUBLIC_PM_URL }} + PUBLIC_DOCS_URL: ${{ vars.PUBLIC_DOCS_URL }} + PUBLIC_LANDING_URL: ${{ vars.PUBLIC_LANDING_URL }} permissions: contents: write From 0709a91326321994e5fb58b8eb3504d40c467458 Mon Sep 17 00:00:00 2001 From: Exelo Date: Sun, 7 Jun 2026 15:28:04 +0900 Subject: [PATCH 5/5] fix: open links in new tab --- src/lib/components/Menu/MenuItem.svelte | 1 + 1 file changed, 1 insertion(+) diff --git a/src/lib/components/Menu/MenuItem.svelte b/src/lib/components/Menu/MenuItem.svelte index 246f2fc..3e3bb35 100644 --- a/src/lib/components/Menu/MenuItem.svelte +++ b/src/lib/components/Menu/MenuItem.svelte @@ -16,6 +16,7 @@ {#if link}