Re-added copy modal

ref #143
This commit is contained in:
Nicolai Ort 2023-02-02 17:11:40 +01:00
parent e10c6480a5
commit fecb07ee37
Signed by: niggl
GPG Key ID: 13AFA55AF62F269F
5 changed files with 13 additions and 11 deletions

View File

@ -4,7 +4,7 @@
import Toastify from "toastify-js"; import Toastify from "toastify-js";
import { tick, createEventDispatcher } from "svelte"; import { tick, createEventDispatcher } from "svelte";
export let copy_modal_open; export let copy_modal_open;
export let new_station; export let new_client;
const dispatch = createEventDispatcher(); const dispatch = createEventDispatcher();
let valueCopy = null; let valueCopy = null;
let areaDom; let areaDom;
@ -13,7 +13,7 @@
copy_modal_open = false; copy_modal_open = false;
} }
async function copy() { async function copy() {
valueCopy = new_station.key; valueCopy = new_client.key;
await tick(); await tick();
areaDom.focus(); areaDom.focus();
areaDom.select(); areaDom.select();
@ -80,7 +80,7 @@
</h3> </h3>
<div class="mt-2 mb-6"> <div class="mt-2 mb-6">
<p class="text-sm text-gray-500"> <p class="text-sm text-gray-500">
{$_('the-scanstations-api-token-will-only-get-displayed-once-you-wont-be-able-to-change-or-view-it-again')} {$_('the-statsclient-api-token-will-only-get-displayed-once-you-wont-be-able-to-change-or-view-it-again')}
<br /> <br />
{$_('please-copy-the-token-and-store-it-somewhere-save')} {$_('please-copy-the-token-and-store-it-somewhere-save')}
</p> </p>
@ -94,7 +94,7 @@
name="token" name="token"
class:bg-green-200={copied} class:bg-green-200={copied}
class="mt-1 focus:ring-indigo-500 focus:border-indigo-500 block w-full shadow-sm rounded-l-md sm:text-sm border-gray-300 border bg-gray-50 text-gray-500 p-2"> class="mt-1 focus:ring-indigo-500 focus:border-indigo-500 block w-full shadow-sm rounded-l-md sm:text-sm border-gray-300 border bg-gray-50 text-gray-500 p-2">
{new_station.key} {new_client.key}
</p> </p>
<div <div
class="bg-gray-200 border-gray-300 border-t border-b border-r text-black rounded-r-md sm:text-sm p-2 mt-1 cursor-pointer"> class="bg-gray-200 border-gray-300 border-t border-b border-r text-black rounded-r-md sm:text-sm p-2 mt-1 cursor-pointer">

View File

@ -2,8 +2,8 @@
import { _ } from "svelte-i18n"; import { _ } from "svelte-i18n";
import store from "../../store"; import store from "../../store";
import AddStatsClientModal from "./AddStatsClientModal.svelte"; import AddStatsClientModal from "./AddStatsClientModal.svelte";
// import CopyStatsClientsTokenModal from "./CopyStatsClientsTokenModal.svelte"; import CopyStatsClientTokenModal from "./CopyStatsClientTokenModal.svelte";
import StatsClientssOverview from "./StatsClientsOverview.svelte"; import StatsClientsOverview from "./StatsClientsOverview.svelte";
export let modal_open = false; export let modal_open = false;
export let copy_modal_open = false; export let copy_modal_open = false;
export let new_client = {}; export let new_client = {};
@ -24,10 +24,10 @@
</button> </button>
{/if} {/if}
</span> </span>
<StatsClientssOverview bind:current_clients bind:modal_open bind:new_client bind:copy_modal_open /> <StatsClientsOverview bind:current_clients bind:modal_open bind:new_client bind:copy_modal_open />
</section> </section>
{#if store.state.jwtinfo.userdetails.permissions.includes('STATSCLIENT:CREATE')} {#if store.state.jwtinfo.userdetails.permissions.includes('STATSCLIENT:CREATE')}
<AddStatsClientModal bind:modal_open bind:current_clients bind:new_client bind:copy_modal_open/> <AddStatsClientModal bind:modal_open bind:current_clients bind:new_client bind:copy_modal_open/>
<!-- <CopyStatsClientsTokenModal bind:copy_modal_open bind:new_client /> --> <CopyStatsClientTokenModal bind:copy_modal_open bind:new_client />
{/if} {/if}

View File

@ -1,7 +1,7 @@
<script> <script>
import { _ } from "svelte-i18n"; import { _ } from "svelte-i18n";
import AddStatsClientModal from "./AddStatsClientModal.svelte"; import AddStatsClientModal from "./AddStatsClientModal.svelte";
import CopyScanStationTokenModal from "./CopyScanStationTokenModal.svelte"; import CopyScanStationTokenModal from "./CopyStatsClientTokenModal.svelte";
import scanstations_empty from "./statsclients_empty.svg"; import scanstations_empty from "./statsclients_empty.svg";
let modal_open = false; let modal_open = false;
let copy_modal_open = false; let copy_modal_open = false;

View File

@ -469,5 +469,6 @@
"statsclient-is-being-added": "Statsclient wird angelegt...", "statsclient-is-being-added": "Statsclient wird angelegt...",
"please-provide-the-required-information-to-create-a-new-statsclient": "Bitte gebe alle für einen Statsclient notwendigen Informationen an", "please-provide-the-required-information-to-create-a-new-statsclient": "Bitte gebe alle für einen Statsclient notwendigen Informationen an",
"you-dont-have-any-scanclients-yet": "Es gibt noch keine Statsclients", "you-dont-have-any-scanclients-yet": "Es gibt noch keine Statsclients",
"add-the-first-statsclient": "Erstelle deinen ersten Statsclient." "add-the-first-statsclient": "Erstelle deinen ersten Statsclient.",
"the-statsclient-api-token-will-only-get-displayed-once-you-wont-be-able-to-change-or-view-it-again": "Der Statsclient Token wird nur einmal angezeigt - du kannst ihn nicht ändern oder ihn dir nochmal anzeigen lassen!"
} }

View File

@ -470,5 +470,6 @@
"statsclient-is-being-added": "Statsclient is being added...", "statsclient-is-being-added": "Statsclient is being added...",
"please-provide-the-required-information-to-create-a-new-statsclient": "Please provide the required information to create a new statsclient", "please-provide-the-required-information-to-create-a-new-statsclient": "Please provide the required information to create a new statsclient",
"you-dont-have-any-scanclients-yet": "You don't have any statsclients yet", "you-dont-have-any-scanclients-yet": "You don't have any statsclients yet",
"add-the-first-statsclient": "Add your first statsclient." "add-the-first-statsclient": "Add your first statsclient.",
"the-statsclient-api-token-will-only-get-displayed-once-you-wont-be-able-to-change-or-view-it-again": "The statsclient api token will only get displayed once - you won't be able to change or view it again!"
} }