diff --git a/.devcontainer/docker-compose.devcontainer.yaml b/.devcontainer/docker-compose.devcontainer.yaml index ccaae78..d356c19 100644 --- a/.devcontainer/docker-compose.devcontainer.yaml +++ b/.devcontainer/docker-compose.devcontainer.yaml @@ -7,11 +7,12 @@ services: volumes: - ..:/workspace environment: - DISPLAY: novnc:0.0 + DISPLAY: ${DISPLAY:-novnc:0.0} healthcheck: disable: true cap_add: - SYS_ADMIN + shm_size: 2gb novnc: image: theasp/novnc:latest diff --git a/src/components/Config.svelte b/src/components/Config.svelte index 6cc5394..248c3e3 100644 --- a/src/components/Config.svelte +++ b/src/components/Config.svelte @@ -4,6 +4,7 @@ import P from 'flowbite-svelte/P.svelte'; import { get } from 'svelte/store'; import Eye from '~/components/Eye.svelte'; + import { putMessage } from '~/lib/messages'; import { launchWebAuthFlow as _launchWebAuthFlow } from '~/lib/raindrop/auth'; import { accessToken, clientID, clientSecret, refreshToken } from '~/lib/settings'; @@ -20,9 +21,10 @@ }); accessToken.set(result.accessToken); refreshToken.set(result.refreshToken); + putMessage({ type: 'success', message: 'Successfully authorized app.' }); } catch (err) { - // TODO: Show error message as modal or toast console.error('Failed to authorize app:', err); + putMessage({ type: 'error', message: String(err) }); } }; @@ -80,7 +82,6 @@ classDiv="w-full mr-2" id="access-token" type={showAccessToken ? 'text' : 'password'} - disabled bind:value={$accessToken} > Access Token diff --git a/src/components/Config.test.ts b/src/components/Config.test.ts index e24e5ba..e460e54 100644 --- a/src/components/Config.test.ts +++ b/src/components/Config.test.ts @@ -71,7 +71,7 @@ describe('access token', () => { const { getByTestId } = render(Config); const input = getByTestId('access-token/input') as HTMLInputElement; expect(input).toBeTruthy(); - expect(input.getAttributeNames()).toContain('disabled'); + expect(input.getAttributeNames()).not.toContain('disabled'); }); it('is masked by default and able to toggle it', async () => { diff --git a/src/components/Message.svelte b/src/components/Message.svelte new file mode 100644 index 0000000..eaec8bc --- /dev/null +++ b/src/components/Message.svelte @@ -0,0 +1,42 @@ + + +{#if message} + {@const color = messageMapping[message.type].color} + {@const icon = messageMapping[message.type].icon} +