diff --git a/package-lock.json b/package-lock.json index e8ba923..372400f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "anvil", - "version": "0.0.10", + "version": "0.0.11", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "anvil", - "version": "0.0.10", + "version": "0.0.11", "dependencies": { "@floating-ui/dom": "1.6.8", "axios": "1.7.2", @@ -20,13 +20,13 @@ "@storybook/addon-a11y": "8.2.6", "@storybook/addon-coverage": "1.0.4", "@storybook/addon-essentials": "8.2.6", - "@storybook/addon-interactions": "^8.2.6", + "@storybook/addon-interactions": "8.2.6", "@storybook/addon-links": "8.2.6", "@storybook/blocks": "8.2.6", "@storybook/builder-vite": "8.2.6", "@storybook/svelte": "8.2.6", "@storybook/sveltekit": "8.2.6", - "@storybook/test": "^8.2.6", + "@storybook/test": "8.2.6", "@sveltejs/adapter-node": "5.2.0", "@sveltejs/kit": "2.5.18", "@sveltejs/vite-plugin-svelte": "3.1.1", diff --git a/package.json b/package.json index a77207c..3f3c8e7 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "anvil", - "version": "0.0.10", + "version": "0.0.11", "private": true, "scripts": { "dev": "vite dev", diff --git a/src/lib/components/atoms/SettingsSidebar.svelte b/src/lib/components/atoms/SettingsSidebar.svelte index b2eb49a..c121fdf 100644 --- a/src/lib/components/atoms/SettingsSidebar.svelte +++ b/src/lib/components/atoms/SettingsSidebar.svelte @@ -37,7 +37,7 @@ You should have received a copy of the GNU Affero General Public License along w name="profile" value="profile" on:change={onTileChanged} - regionLabel="float-start ps-2 py-1 text-surface-500" + regionLabel="float-start ps-2 py-1 font-normal text-surface-500 !text-xl" regionLead="float-start ps-8 text-surface-500" title={$_('settings.profile.label')} > @@ -51,7 +51,7 @@ You should have received a copy of the GNU Affero General Public License along w name="account" value="account" on:change={onTileChanged} - regionLabel="float-start ps-2 py-1 text-surface-500" + regionLabel="float-start ps-2 py-1 font-normal text-surface-500 !text-xl" regionLead="float-start ps-8 text-surface-500" title={$_('settings.account.label')} > @@ -65,7 +65,7 @@ You should have received a copy of the GNU Affero General Public License along w name="ssh_gpg_keys" value="ssh_gpg_keys" on:change={onTileChanged} - regionLabel="float-start ps-2 py-1 text-surface-500" + regionLabel="float-start ps-2 py-1 font-normal text-surface-500 !text-xl" regionLead="float-start ps-8 text-surface-500" title={$_('settings.ssh_gpg_keys.label')} > @@ -79,7 +79,7 @@ You should have received a copy of the GNU Affero General Public License along w name="appearance" value="appearance" on:change={onTileChanged} - regionLabel="float-start ps-2 py-1 text-surface-500" + regionLabel="float-start ps-2 py-1 font-normal text-surface-500 !text-xl" regionLead="float-start ps-8 text-surface-500" title={$_('settings.appearance.label')} > @@ -93,7 +93,7 @@ You should have received a copy of the GNU Affero General Public License along w name="notifications" value="notifications" on:change={onTileChanged} - regionLabel="float-start ps-2 py-1 text-surface-500" + regionLabel="float-start ps-2 py-1 font-normal text-surface-500 !text-xl" regionLead="float-start ps-8 text-surface-500" title={$_('settings.notifications.label')} > diff --git a/src/lib/components/molecules/Settings.svelte b/src/lib/components/molecules/Settings.svelte index 4fd24d8..c915308 100644 --- a/src/lib/components/molecules/Settings.svelte +++ b/src/lib/components/molecules/Settings.svelte @@ -12,6 +12,7 @@ You should have received a copy of the GNU Affero General Public License along w --> -
+
{#if activeSetting === 'profile'} + {:else if activeSetting === 'account'} + {/if}
diff --git a/src/lib/components/molecules/SettingsAccount.svelte b/src/lib/components/molecules/SettingsAccount.svelte new file mode 100644 index 0000000..3cc0c5d --- /dev/null +++ b/src/lib/components/molecules/SettingsAccount.svelte @@ -0,0 +1,43 @@ + + + + +
+
{$_('settings.account.headline')}
+
+
+ {$_('settings.account.f2.label')} + +
+
+ {$_('settings.account.password.label')} + + {$_('settings.account.password.reset')} +
+
+ {$_('settings.account.verification.label')} + +
+
+ +
+
+
diff --git a/src/lib/components/molecules/SettingsProfile.svelte b/src/lib/components/molecules/SettingsProfile.svelte index 1db938a..9cb2570 100644 --- a/src/lib/components/molecules/SettingsProfile.svelte +++ b/src/lib/components/molecules/SettingsProfile.svelte @@ -16,7 +16,7 @@ You should have received a copy of the GNU Affero General Public License along w import { Person24, Upload16, XCircleFill12 } from 'svelte-octicons'; -
+
{$_('settings.profile.headline')}
{$_('settings.profile.avatar.headline')}
diff --git a/src/lib/i18n/locales/bg.json b/src/lib/i18n/locales/bg.json index 4e98e44..9776dec 100644 --- a/src/lib/i18n/locales/bg.json +++ b/src/lib/i18n/locales/bg.json @@ -176,7 +176,20 @@ "settings": { "headline": "", "account": { - "label": "" + "delete": "", + "f2": { + "label": "", + "placeholder": "" + }, + "headline": "", + "label": "", + "password": { + "label": "", + "reset": "" + }, + "verification": { + "label": "" + } }, "appearance": { "label": "" diff --git a/src/lib/i18n/locales/de.json b/src/lib/i18n/locales/de.json index dea5c94..e2aa512 100644 --- a/src/lib/i18n/locales/de.json +++ b/src/lib/i18n/locales/de.json @@ -176,7 +176,20 @@ "settings": { "headline": "", "account": { - "label": "" + "delete": "", + "f2": { + "label": "", + "placeholder": "" + }, + "headline": "", + "label": "", + "password": { + "label": "", + "reset": "" + }, + "verification": { + "label": "" + } }, "appearance": { "label": "" diff --git a/src/lib/i18n/locales/en.json b/src/lib/i18n/locales/en.json index 76b9861..87086ae 100644 --- a/src/lib/i18n/locales/en.json +++ b/src/lib/i18n/locales/en.json @@ -176,7 +176,20 @@ "settings": { "headline": "Settings", "account": { - "label": "Account" + "delete": "Delete account", + "f2": { + "label": "F2 Account", + "placeholder": "@user@server.com" + }, + "headline": "Account", + "label": "Account", + "password": { + "label": "Password", + "reset": "Reset password" + }, + "verification": { + "label": "Verification mail" + } }, "appearance": { "label": "Appearance" diff --git a/src/lib/i18n/locales/he.json b/src/lib/i18n/locales/he.json index 1fb4b80..7a796e8 100644 --- a/src/lib/i18n/locales/he.json +++ b/src/lib/i18n/locales/he.json @@ -176,7 +176,20 @@ "settings": { "headline": "", "account": { - "label": "" + "delete": "", + "f2": { + "label": "", + "placeholder": "" + }, + "headline": "", + "label": "", + "password": { + "label": "", + "reset": "" + }, + "verification": { + "label": "" + } }, "appearance": { "label": "" diff --git a/src/lib/i18n/locales/pl.json b/src/lib/i18n/locales/pl.json index a60ed41..b1082b1 100644 --- a/src/lib/i18n/locales/pl.json +++ b/src/lib/i18n/locales/pl.json @@ -176,7 +176,20 @@ "settings": { "headline": "", "account": { - "label": "" + "delete": "", + "f2": { + "label": "", + "placeholder": "" + }, + "headline": "", + "label": "", + "password": { + "label": "", + "reset": "" + }, + "verification": { + "label": "" + } }, "appearance": { "label": "" diff --git a/stories/molecules/SettingsAccount.stories.ts b/stories/molecules/SettingsAccount.stories.ts new file mode 100644 index 0000000..58eff1f --- /dev/null +++ b/stories/molecules/SettingsAccount.stories.ts @@ -0,0 +1,26 @@ +/* Stories for SettingsAccount molecule. + * Copyright (C) 2024 André Jaenisch + * SPDX-FileCopyrightText: 2024 André Jaenisch + * SPDX-License-Identifier: AGPL-3.0-or-later + * + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License along with this program. If not, see . + */ + +import type { Meta, StoryObj } from '@storybook/svelte'; + +import SettingsAccount from '$lib/components/molecules/SettingsAccount.svelte'; + +const meta = { + title: 'Molecules/SettingsAccount', + component: SettingsAccount, + tags: ['autodocs'] +} satisfies Meta; + +export default meta; +type Story = StoryObj; + +export const Plain: Story = {}; diff --git a/tests/components/molecules/SettingsAccount.test.ts b/tests/components/molecules/SettingsAccount.test.ts new file mode 100644 index 0000000..ed6c5f9 --- /dev/null +++ b/tests/components/molecules/SettingsAccount.test.ts @@ -0,0 +1,91 @@ +/* Component test for SettingsAccount molecule. + * Copyright (C) 2024 André Jaenisch + * SPDX-FileCopyrightText: 2024 André Jaenisch + * SPDX-License-Identifier: AGPL-3.0-or-later + * + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License along with this program. If not, see . + */ + +import '@testing-library/jest-dom'; +import { render, screen } from '@testing-library/svelte'; +import { init, locale, register } from 'svelte-i18n'; + +import SettingsAccount from '../../../src/lib/components/molecules/SettingsAccount.svelte'; +import enMessages from '../../../src/lib/i18n/locales/en.json'; + +describe('SettingsAccount.svelte', () => { + beforeEach(() => { + register('en', () => import('../../../src/lib/i18n/locales/en.json')); + init({ fallbackLocale: 'en', initialLocale: 'en' }); + locale.set('en'); + }); + + it('should mount', () => { + // Arrange + // Nothing to prepare + + // Act + const { container } = render(SettingsAccount); + + // Assert + expect(container).toBeTruthy(); + }); + + it('should have an account input', () => { + // Arrange + // Nothing to prepare + + // Act + render(SettingsAccount); + + // Assert + expect( + screen.getByPlaceholderText(enMessages.settings.account.f2.placeholder) + ).toBeInTheDocument(); + }); + + // TODO: Mark up proper label and input + it.skip('should have a password input', () => { + // Arrange + // Nothing to prepare + + // Act + render(SettingsAccount); + + // Assert + expect( + screen.getByPlaceholderText(enMessages.settings.account.password.label) + ).toBeInTheDocument(); + }); + + // TODO: Mark up proper label and input + it.skip('should have a verification mail input', () => { + // Arrange + // Nothing to prepare + + // Act + render(SettingsAccount); + + // Assert + expect( + screen.getByPlaceholderText(enMessages.settings.account.verification.label) + ).toBeInTheDocument(); + }); + + it('should have a delete account button', () => { + // Arrange + // Nothing to prepare + + // Act + render(SettingsAccount); + + // Assert + expect( + screen.getByRole('button', { name: enMessages.settings.account.delete }) + ).toBeInTheDocument(); + }); +});