From 297bafcdc8875eadf0cbae6c206dd64cba6434cd Mon Sep 17 00:00:00 2001 From: Alice Gaudon Date: Sat, 20 Nov 2021 22:55:25 +0100 Subject: [PATCH 1/7] Add style to error pages --- src/assets/views/errors/Error.svelte | 103 +++++++++++++++++++++++++-- 1 file changed, 99 insertions(+), 4 deletions(-) diff --git a/src/assets/views/errors/Error.svelte b/src/assets/views/errors/Error.svelte index 00248a1..a881ef5 100644 --- a/src/assets/views/errors/Error.svelte +++ b/src/assets/views/errors/Error.svelte @@ -1,5 +1,7 @@ {#if hasRoute('change-name')}
-

Change name

+

Change name

{#if $locals.can_change_name} diff --git a/src/assets/views/auth/account/PasswordPanel.svelte b/src/assets/views/auth/account/PasswordPanel.svelte index f25869b..151cea0 100644 --- a/src/assets/views/auth/account/PasswordPanel.svelte +++ b/src/assets/views/auth/account/PasswordPanel.svelte @@ -3,13 +3,14 @@ import Form from "../../utils/Form.svelte"; import Field from "../../utils/Field.svelte"; import {hasRoute, route} from "../../../../common/Routing"; + import Icon from "../../utils/Icon.svelte"; let removePasswordMode = false; {#if hasRoute('remove-password', 'change-password')}
-

{$locals.has_password ? 'Change' : 'Set'} password

+

{$locals.has_password ? 'Change' : 'Set'} password

{#if removePasswordMode}
-

Personal information

+

Personal information

{#if $locals.display_email_warning && $locals.emails.length <= 0} @@ -40,7 +41,7 @@ {/if}
-

Email addresses

+

Email addresses

diff --git a/src/assets/views/auth/auth.svelte b/src/assets/views/auth/auth.svelte index ad14119..db3f8d4 100644 --- a/src/assets/views/auth/auth.svelte +++ b/src/assets/views/auth/auth.svelte @@ -25,7 +25,7 @@
{#if hasRoute('login')}
-

Log in

+

Log in

-

Register

+

Register

diff --git a/src/assets/views/backend/index.svelte b/src/assets/views/backend/index.svelte index 6c29bbe..fba4ee8 100644 --- a/src/assets/views/backend/index.svelte +++ b/src/assets/views/backend/index.svelte @@ -2,6 +2,7 @@ import {locals} from "../../ts/stores.js"; import BaseLayout from "../layouts/BaseLayout.svelte"; import Breadcrumb from "../components/Breadcrumb.svelte"; + import Icon from "../utils/Icon.svelte"; const menu = $locals.menu || []; @@ -19,7 +20,7 @@
  • {#if element.display_icon !== null} - + {/if} {element.display_string} diff --git a/src/assets/views/components/Message.svelte b/src/assets/views/components/Message.svelte index 099e908..2adf74a 100644 --- a/src/assets/views/components/Message.svelte +++ b/src/assets/views/components/Message.svelte @@ -45,7 +45,7 @@ border-radius: 5px; - :global(.feather) { + :global(.icon) { --icon-size: 24px; margin-right: 8px; } @@ -77,7 +77,7 @@ &-discreet { color: var(--on-surface); - .feather { + .icon { --icon-size: 20px; } } @@ -94,7 +94,7 @@ border: 0; - :global(.feather) { + :global(.icon) { margin: 0; } } diff --git a/src/assets/views/components/NavMenu.svelte b/src/assets/views/components/NavMenu.svelte index 01e4b6e..badaf49 100644 --- a/src/assets/views/components/NavMenu.svelte +++ b/src/assets/views/components/NavMenu.svelte @@ -96,7 +96,7 @@ border-radius: $headerHeight; - :global(.feather) { + :global(.icon) { --icon-size: 28px; margin: 0; } diff --git a/src/assets/views/components/NavMenuItem.svelte b/src/assets/views/components/NavMenuItem.svelte index 4f104ed..b01d4c8 100644 --- a/src/assets/views/components/NavMenuItem.svelte +++ b/src/assets/views/components/NavMenuItem.svelte @@ -58,7 +58,7 @@ } } - :global(.feather) { + :global(.icon) { --icon-size: 16px; margin-right: 8px; } diff --git a/src/assets/views/utils/Field.svelte b/src/assets/views/utils/Field.svelte index 2fba537..c76df9a 100644 --- a/src/assets/views/utils/Field.svelte +++ b/src/assets/views/utils/Field.svelte @@ -96,7 +96,7 @@ background-color: var(--input); border-radius: 5px; - > :global(.feather.icon) { + > :global(.icon) { --icon-size: 24px; margin: 18px; opacity: 0.75; @@ -180,7 +180,7 @@ display: none; } - & + :global(.feather) { + & + :global(.icon) { position: absolute; pointer-events: none; right: 0; @@ -190,7 +190,7 @@ } // TODO: Temporary - &:focus + :global(.feather) { + &:focus + :global(.icon) { transform: rotateX(180deg); } } @@ -317,7 +317,7 @@ .name { font-size: 20px; - :global(.feather) { + :global(.icon) { --icon-size: 24px; margin-right: 8px; } diff --git a/src/assets/views/utils/Icon.svelte b/src/assets/views/utils/Icon.svelte index b17bd44..5063048 100644 --- a/src/assets/views/utils/Icon.svelte +++ b/src/assets/views/utils/Icon.svelte @@ -1,23 +1,17 @@ - + {#if hasRoute('backend')} - + diff --git a/src/assets/views/backend/index.svelte b/src/assets/views/backend/index.svelte index fba4ee8..6ad2f95 100644 --- a/src/assets/views/backend/index.svelte +++ b/src/assets/views/backend/index.svelte @@ -1,13 +1,13 @@ - +
    @@ -30,4 +30,4 @@
  • - + diff --git a/src/assets/views/errors/400.svelte b/src/assets/views/errors/400.svelte index 5ad9f17..26064ed 100644 --- a/src/assets/views/errors/400.svelte +++ b/src/assets/views/errors/400.svelte @@ -1,5 +1,5 @@ - + diff --git a/src/assets/views/errors/401.svelte b/src/assets/views/errors/401.svelte index a6d9d83..516d82a 100644 --- a/src/assets/views/errors/401.svelte +++ b/src/assets/views/errors/401.svelte @@ -1,5 +1,5 @@ - + diff --git a/src/assets/views/errors/403.svelte b/src/assets/views/errors/403.svelte index 98a397f..489c6b5 100644 --- a/src/assets/views/errors/403.svelte +++ b/src/assets/views/errors/403.svelte @@ -1,5 +1,5 @@ - + diff --git a/src/assets/views/errors/404.svelte b/src/assets/views/errors/404.svelte index 69c414d..1e526bb 100644 --- a/src/assets/views/errors/404.svelte +++ b/src/assets/views/errors/404.svelte @@ -1,5 +1,5 @@ - + diff --git a/src/assets/views/errors/429.svelte b/src/assets/views/errors/429.svelte index cd0e471..04ef391 100644 --- a/src/assets/views/errors/429.svelte +++ b/src/assets/views/errors/429.svelte @@ -1,5 +1,5 @@ - + diff --git a/src/assets/views/errors/500.svelte b/src/assets/views/errors/500.svelte index 4682025..ab3ccd4 100644 --- a/src/assets/views/errors/500.svelte +++ b/src/assets/views/errors/500.svelte @@ -1,5 +1,5 @@ - + diff --git a/src/assets/views/errors/503.svelte b/src/assets/views/errors/503.svelte index 47e7f5b..4f7ceef 100644 --- a/src/assets/views/errors/503.svelte +++ b/src/assets/views/errors/503.svelte @@ -1,5 +1,5 @@ - + diff --git a/src/assets/views/home.svelte b/src/assets/views/home.svelte index b03826a..ac6c4c3 100644 --- a/src/assets/views/home.svelte +++ b/src/assets/views/home.svelte @@ -1,10 +1,10 @@ - +

    swaf - Svelte Web Application Framework

    Welcome to {$locals.app.name}!

    @@ -22,4 +22,4 @@ {/if}
    -
    + diff --git a/src/assets/views/magic_link.svelte b/src/assets/views/magic_link.svelte index d764927..fc3346b 100644 --- a/src/assets/views/magic_link.svelte +++ b/src/assets/views/magic_link.svelte @@ -1,13 +1,13 @@ - +
    {#if $locals.err} @@ -18,4 +18,4 @@ {/if}
    -
    + diff --git a/src/assets/views/magic_link_lobby.svelte b/src/assets/views/magic_link_lobby.svelte index b82e291..21b8eb9 100644 --- a/src/assets/views/magic_link_lobby.svelte +++ b/src/assets/views/magic_link_lobby.svelte @@ -1,6 +1,6 @@ - +
    Waiting for you to open the link...

    -
    + diff --git a/src/assets/views/layouts/BaseLayout.svelte b/src/assets/views/templates/BaseTemplate.svelte similarity index 100% rename from src/assets/views/layouts/BaseLayout.svelte rename to src/assets/views/templates/BaseTemplate.svelte diff --git a/src/assets/views/errors/Error.svelte b/src/assets/views/templates/ErrorTemplate.svelte similarity index 100% rename from src/assets/views/errors/Error.svelte rename to src/assets/views/templates/ErrorTemplate.svelte diff --git a/src/assets/views/layouts/base/BaseFooter.svelte b/src/assets/views/templates/base/BaseFooter.svelte similarity index 100% rename from src/assets/views/layouts/base/BaseFooter.svelte rename to src/assets/views/templates/base/BaseFooter.svelte diff --git a/src/assets/views/layouts/base/BaseHeader.svelte b/src/assets/views/templates/base/BaseHeader.svelte similarity index 100% rename from src/assets/views/layouts/base/BaseHeader.svelte rename to src/assets/views/templates/base/BaseHeader.svelte diff --git a/src/assets/views/layouts/base/BaseHeaderLogo.svelte b/src/assets/views/templates/base/BaseHeaderLogo.svelte similarity index 100% rename from src/assets/views/layouts/base/BaseHeaderLogo.svelte rename to src/assets/views/templates/base/BaseHeaderLogo.svelte diff --git a/src/assets/views/layouts/base/BaseNavMenuAuth.svelte b/src/assets/views/templates/base/BaseNavMenuAuth.svelte similarity index 100% rename from src/assets/views/layouts/base/BaseNavMenuAuth.svelte rename to src/assets/views/templates/base/BaseNavMenuAuth.svelte diff --git a/src/assets/views/layouts/base/BaseNavMenuLinks.svelte b/src/assets/views/templates/base/BaseNavMenuLinks.svelte similarity index 100% rename from src/assets/views/layouts/base/BaseNavMenuLinks.svelte rename to src/assets/views/templates/base/BaseNavMenuLinks.svelte diff --git a/src/assets/views/layouts/svelte_layout.html b/src/assets/views/templates/svelte_template.html similarity index 100% rename from src/assets/views/layouts/svelte_layout.html rename to src/assets/views/templates/svelte_template.html diff --git a/src/frontend/SvelteViewEngine.ts b/src/frontend/SvelteViewEngine.ts index 58bda91..e267b90 100644 --- a/src/frontend/SvelteViewEngine.ts +++ b/src/frontend/SvelteViewEngine.ts @@ -64,7 +64,7 @@ export default class SvelteViewEngine extends ViewEngine { const view = await this.fileCache.get(actualFile, !config.get('view.cache')); // Root template - const templateFile = await this.resolveFileFromCanonicalNameOrFail('layouts/svelte_layout.html'); + const templateFile = await this.resolveFileFromCanonicalNameOrFail('templates/svelte_template.html'); const rawOutput = await this.fileCache.get(templateFile, !config.get('view.cache')); // Pre-compiled parts diff --git a/test/assets/views/design.svelte b/test/assets/views/design.svelte index 7986e35..f672b3a 100644 --- a/test/assets/views/design.svelte +++ b/test/assets/views/design.svelte @@ -1,6 +1,6 @@ - +
    @@ -114,6 +114,6 @@ {link: route('design'), title: 'self'}, ]}/>
    -
    + diff --git a/test/assets/views/tests.svelte b/test/assets/views/tests.svelte index a2821f4..705f159 100644 --- a/test/assets/views/tests.svelte +++ b/test/assets/views/tests.svelte @@ -1,6 +1,6 @@ From 428990dc00b73c5058eaa037b6e74eb155682ac6 Mon Sep 17 00:00:00 2001 From: Alice Gaudon Date: Sun, 21 Nov 2021 13:15:15 +0100 Subject: [PATCH 4/7] front/home page: make first word of the title choosen at random in a list --- src/assets/views/home.svelte | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/assets/views/home.svelte b/src/assets/views/home.svelte index ac6c4c3..4dc7521 100644 --- a/src/assets/views/home.svelte +++ b/src/assets/views/home.svelte @@ -2,11 +2,19 @@ import {locals} from "../ts/stores"; import {route, hasRoute, hasAnyRoute} from "../../common/Routing"; import BaseTemplate from "./templates/BaseTemplate.svelte"; + import {onMount} from "svelte"; + + let randomTitleSWord = 'Svelte'; + const possibleSWords = ['Svelte', 'Simple', 'Scalable', 'Super', 'Structure', 'Satisfying']; + + onMount(() => { + randomTitleSWord = possibleSWords[Math.floor(Math.random() * possibleSWords.length)]; + });
    -

    swaf - Svelte Web Application Framework

    +

    swaf - {randomTitleSWord} Web Application Framework

    Welcome to {$locals.app.name}!

    {#if hasAnyRoute('tests', 'design')} From e9db1f4ded10e9cac9ec50b0142bcda6fc1cd7c0 Mon Sep 17 00:00:00 2001 From: Alice Gaudon Date: Sun, 21 Nov 2021 15:02:31 +0100 Subject: [PATCH 5/7] front: add an external link icon to external links --- src/assets/scss/base.scss | 2 +- .../views/scripts/ExternalLinkIcons.svelte | 32 +++++++++++++++++++ .../views/templates/BaseTemplate.svelte | 3 ++ .../views/templates/CommonScripts.svelte | 5 +++ .../views/templates/ErrorTemplate.svelte | 3 ++ test/assets/views/design.svelte | 2 +- 6 files changed, 45 insertions(+), 2 deletions(-) create mode 100644 src/assets/views/scripts/ExternalLinkIcons.svelte create mode 100644 src/assets/views/templates/CommonScripts.svelte diff --git a/src/assets/scss/base.scss b/src/assets/scss/base.scss index a98f1d3..22ae0fc 100644 --- a/src/assets/scss/base.scss +++ b/src/assets/scss/base.scss @@ -155,7 +155,7 @@ h1 { a { text-decoration: none; - .icon.feather-external-link { //todo add js + .icon.lucide-external-link { //todo add js --icon-size: 16px; margin-left: 4px; margin-top: -3px; diff --git a/src/assets/views/scripts/ExternalLinkIcons.svelte b/src/assets/views/scripts/ExternalLinkIcons.svelte new file mode 100644 index 0000000..62f0a81 --- /dev/null +++ b/src/assets/views/scripts/ExternalLinkIcons.svelte @@ -0,0 +1,32 @@ + + + + +
    + +
    diff --git a/src/assets/views/templates/BaseTemplate.svelte b/src/assets/views/templates/BaseTemplate.svelte index 4d10962..755d987 100644 --- a/src/assets/views/templates/BaseTemplate.svelte +++ b/src/assets/views/templates/BaseTemplate.svelte @@ -2,6 +2,7 @@ import FlashMessages from "../components/FlashMessages.svelte"; import BaseFooter from "./base/BaseFooter.svelte"; import BaseHeader from "./base/BaseHeader.svelte"; + import CommonScripts from "./CommonScripts.svelte"; export let title: string; export let h1: string = title; @@ -9,6 +10,8 @@ export let refresh_after: number | undefined = undefined; + + + + +
    +
    {title}
    +
    {content}
    + + + {#if showCopiedOverlay} +
    Copied!
    + {/if} +
    diff --git a/test/assets/views/design.svelte b/test/assets/views/design.svelte index a41f23f..800cc67 100644 --- a/test/assets/views/design.svelte +++ b/test/assets/views/design.svelte @@ -9,6 +9,7 @@ import Breadcrumb from "./components/Breadcrumb.svelte"; import Icon from "./utils/Icon.svelte"; import DesignButtons from "./DesignButtons.svelte"; + import CopyableText from "./components/CopyableText.svelte"; const paginationData = new PaginationData(20, 20, 1000).serialize(); @@ -114,6 +115,15 @@ {link: route('design'), title: 'self'}, ]}/>
    + +
    +

    + + Copyable text +

    + + +
    From c7d0238d22ebda8cb513d56ba9ee0ea23eb8255c Mon Sep 17 00:00:00 2001 From: Alice Gaudon Date: Sun, 21 Nov 2021 16:50:47 +0100 Subject: [PATCH 7/7] Version 0.24.6 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index b5f27d2..1091a0b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "swaf", - "version": "0.24.5", + "version": "0.24.6", "description": "Structure Web Application Framework.", "repository": "https://eternae.ink/ashpie/swaf", "author": "Alice Gaudon ",