From f353b0709f4fbd689f43853335fd08cac76a8dee Mon Sep 17 00:00:00 2001 From: Thibault Date: Sun, 31 Mar 2024 16:58:20 +0200 Subject: [PATCH] feat: add copy button and animations when success and format --- web-app/package.json | 74 ++++++++++---------- web-app/src/lib/GenerateUrl/LoginForm.svelte | 30 +++++--- web-app/src/lib/GenerateUrl/ShowUrl.svelte | 47 ++++++++++++- web-app/src/lib/UI/TwoTextComponent.svelte | 20 ++++++ web-app/src/lib/i18n/locales/en.json | 3 +- web-app/src/lib/i18n/locales/fr.json | 5 +- 6 files changed, 126 insertions(+), 53 deletions(-) create mode 100644 web-app/src/lib/UI/TwoTextComponent.svelte diff --git a/web-app/package.json b/web-app/package.json index 9764802..b63b519 100644 --- a/web-app/package.json +++ b/web-app/package.json @@ -1,39 +1,39 @@ { - "name": "web-app", - "version": "0.0.1", - "scripts": { - "dev": "vite dev", - "build": "vite build", - "preview": "vite preview", - "check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json", - "check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch", - "test": "vitest", - "lint": "prettier --plugin-search-dir . --check . && eslint .", - "format": "prettier --plugin-search-dir . --write ." - }, - "devDependencies": { - "@fontsource/fira-mono": "^4.5.10", - "@neoconfetti/svelte": "^1.0.0", - "@sveltejs/adapter-auto": "^2.0.0", - "@sveltejs/adapter-static": "^2.0.3", - "@sveltejs/kit": "^1.20.4", - "@types/cookie": "^0.5.1", - "@typescript-eslint/eslint-plugin": "^6.0.0", - "@typescript-eslint/parser": "^6.0.0", - "eslint": "^8.28.0", - "eslint-config-prettier": "^8.5.0", - "eslint-plugin-svelte": "^2.30.0", - "prettier": "^2.8.0", - "prettier-plugin-svelte": "^2.10.1", - "svelte": "^4.0.5", - "svelte-check": "^3.4.3", - "tslib": "^2.4.1", - "typescript": "^5.0.0", - "vite": "^4.4.2", - "vitest": "^0.34.0" - }, - "type": "module", - "dependencies": { - "svelte-i18n": "^3.7.4" - } + "name": "web-app", + "version": "0.0.1", + "scripts": { + "dev": "vite dev", + "build": "vite build", + "preview": "vite preview", + "check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json", + "check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch", + "test": "vitest", + "lint": "prettier --plugin-search-dir . --check . && eslint .", + "format": "prettier --plugin-search-dir . --write ." + }, + "devDependencies": { + "@fontsource/fira-mono": "^4.5.10", + "@neoconfetti/svelte": "^1.0.0", + "@sveltejs/adapter-auto": "^2.0.0", + "@sveltejs/adapter-static": "^2.0.3", + "@sveltejs/kit": "^1.20.4", + "@types/cookie": "^0.5.1", + "@typescript-eslint/eslint-plugin": "^6.0.0", + "@typescript-eslint/parser": "^6.0.0", + "eslint": "^8.28.0", + "eslint-config-prettier": "^8.5.0", + "eslint-plugin-svelte": "^2.30.0", + "prettier": "^2.8.0", + "prettier-plugin-svelte": "^2.10.1", + "svelte": "^4.0.5", + "svelte-check": "^3.4.3", + "tslib": "^2.4.1", + "typescript": "^5.0.0", + "vite": "^4.4.2", + "vitest": "^0.34.0" + }, + "type": "module", + "dependencies": { + "svelte-i18n": "^3.7.4" + } } diff --git a/web-app/src/lib/GenerateUrl/LoginForm.svelte b/web-app/src/lib/GenerateUrl/LoginForm.svelte index abbe1f9..288efc8 100644 --- a/web-app/src/lib/GenerateUrl/LoginForm.svelte +++ b/web-app/src/lib/GenerateUrl/LoginForm.svelte @@ -1,9 +1,10 @@ {#if $dataParams !== ''} @@ -13,8 +21,15 @@ {$t('generateUrl.urlGenerated')} -
- {url} +
+ + {url} + +
+ +
{/if} @@ -24,4 +39,30 @@ color: white; background-color: var(--primary-background); } + + .custom-container { + display: grid; + grid-template-columns: auto auto; + } + + .sub-container { + margin-left: 2vw; + position: relative; + min-width: 130px; + } + + .sub-container button { + background-color: var(--primary-color); + border-color: var(--primary-color); + position: absolute; + top: 50%; + transform: translateY(-50%); + } + + code { + display: grid; + align-items: center; + overflow-wrap: anywhere; + min-height: 60px; + } diff --git a/web-app/src/lib/UI/TwoTextComponent.svelte b/web-app/src/lib/UI/TwoTextComponent.svelte new file mode 100644 index 0000000..7438cae --- /dev/null +++ b/web-app/src/lib/UI/TwoTextComponent.svelte @@ -0,0 +1,20 @@ + + +{originalText} +{otherText} diff --git a/web-app/src/lib/i18n/locales/en.json b/web-app/src/lib/i18n/locales/en.json index 3b23ae6..ed1ec22 100644 --- a/web-app/src/lib/i18n/locales/en.json +++ b/web-app/src/lib/i18n/locales/en.json @@ -20,5 +20,6 @@ "id": "Team id" }, "urlGenerated": "Generated URL" - } + }, + "copy": "Copy" } diff --git a/web-app/src/lib/i18n/locales/fr.json b/web-app/src/lib/i18n/locales/fr.json index d71588c..65f6cbc 100644 --- a/web-app/src/lib/i18n/locales/fr.json +++ b/web-app/src/lib/i18n/locales/fr.json @@ -17,8 +17,9 @@ "listTeams": { "title": "Liste des équipes", "name": "Nom de l'équipe", - "id": "Identifiant de l'équipe" + "id": "Identifiant de l'équipe" }, "urlGenerated": "URL générée" - } + }, + "copy": "Copier" }