Skip to content

Commit de0de8c

Browse files
committed
Minor UI improvements
1 parent a41684b commit de0de8c

File tree

6 files changed

+136
-117
lines changed

6 files changed

+136
-117
lines changed

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "flipper-authenticator-companion",
33
"version": "1.1.1",
44
"private": true,
5-
"description": "Flipper Authenticator Companion App",
5+
"description": "Companion application for Flipper Authenticator software-based TOTP authenticator for Flipper Zero device",
66
"main": "src/electron.cjs",
77
"type": "module",
88
"author": "Alexander Kopachov (@akopachov)",
@@ -37,7 +37,7 @@
3737
"@tailwindcss/typography": "^0.5.9",
3838
"@types/node": "^20.5.7",
3939
"@types/papaparse": "^5.3.8",
40-
"@types/uuid": "^9.0.2",
40+
"@types/uuid": "^9.0.3",
4141
"@typescript-eslint/eslint-plugin": "^6.5.0",
4242
"@typescript-eslint/parser": "^6.5.0",
4343
"async-sema": "^3.1.1",

pnpm-lock.yaml

Lines changed: 14 additions & 14 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/components/totp-list/totp-list.svelte

Lines changed: 114 additions & 96 deletions
Original file line numberDiff line numberDiff line change
@@ -101,99 +101,117 @@
101101
}
102102
</script>
103103

104-
<ul
105-
class="list p-4 pt-3 pb-3"
106-
use:dndzone={{
107-
items: internalList,
108-
dragDisabled,
109-
flipDurationMs: flipAnimationMs,
110-
dropTargetStyle: {},
111-
transformDraggedElement,
112-
}}
113-
on:consider={handleConsider}
114-
on:finalize={handleFinalize}>
115-
{#each internalList as item (item.id)}
116-
{@const totp = item.item}
117-
<div animate:flip={{ duration: flipAnimationMs }}>
118-
<li class="h-14 p-1">
119-
<i
120-
class="material-icons drag-handle cursor-move"
121-
on:mousedown={startDrag}
122-
on:touchstart={startDrag}
123-
on:keydown={handleKeyDown}
124-
role="none">
125-
<svg
126-
viewBox="0 0 16 16"
127-
stroke-width="1.5"
128-
fill="currentColor"
129-
class="w-6 h-6"
130-
xmlns="http://www.w3.org/2000/svg">
131-
<path
132-
fill-rule="evenodd"
133-
d="M7.375 3.67c0-.645-.56-1.17-1.25-1.17s-1.25.525-1.25 1.17c0 .646.56 1.17 1.25 1.17s1.25-.524 1.25-1.17zm0 8.66c0-.646-.56-1.17-1.25-1.17s-1.25.524-1.25 1.17c0 .645.56 1.17 1.25 1.17s1.25-.525 1.25-1.17zm-1.25-5.5c.69 0 1.25.525 1.25 1.17 0 .645-.56 1.17-1.25 1.17S4.875 8.645 4.875 8c0-.645.56-1.17 1.25-1.17zm5-3.16c0-.645-.56-1.17-1.25-1.17s-1.25.525-1.25 1.17c0 .646.56 1.17 1.25 1.17s1.25-.524 1.25-1.17zm-1.25 7.49c.69 0 1.25.524 1.25 1.17 0 .645-.56 1.17-1.25 1.17s-1.25-.525-1.25-1.17c0-.646.56-1.17 1.25-1.17zM11.125 8c0-.645-.56-1.17-1.25-1.17s-1.25.525-1.25 1.17c0 .645.56 1.17 1.25 1.17s1.25-.525 1.25-1.17z" />
134-
</svg>
135-
</i>
136-
<img class="avatar-image h-full w-auto object-cover" src={getIcon(totp.name)} alt="icon" />
137-
<p class="flex-auto block min-w-0">
138-
<span class="block text-base truncate">{totp.name}</span>
139-
<span class="block text-sm uppercase">{totp.hashingAlgo}</span>
140-
</p>
141-
<button type="button" use:popup={getTotpItemMenuSettings(item.id)}>
142-
<svg
143-
xmlns="http://www.w3.org/2000/svg"
144-
fill="none"
145-
viewBox="0 0 24 24"
146-
stroke-width="1.5"
147-
stroke="currentColor"
148-
class="w-6 h-6">
149-
<path
150-
stroke-linecap="round"
151-
stroke-linejoin="round"
152-
d="M12 6.75a.75.75 0 110-1.5.75.75 0 010 1.5zM12 12.75a.75.75 0 110-1.5.75.75 0 010 1.5zM12 18.75a.75.75 0 110-1.5.75.75 0 010 1.5z" />
153-
</svg>
154-
</button>
155-
<div class="card p-4 w-48 shadow-md !transition-none !duration-0" data-popup="totpItemMenu_{item.id}">
156-
<nav class="list-nav">
157-
<ul>
158-
<li>
159-
<a class="flex-auto" href="/update/{item.item.id}">
160-
<svg
161-
xmlns="http://www.w3.org/2000/svg"
162-
fill="none"
163-
viewBox="0 0 24 24"
164-
stroke-width="1.5"
165-
stroke="currentColor"
166-
class="w-6 h-6">
167-
<path
168-
stroke-linecap="round"
169-
stroke-linejoin="round"
170-
d="M16.862 4.487l1.687-1.688a1.875 1.875 0 112.652 2.652L10.582 16.07a4.5 4.5 0 01-1.897 1.13L6 18l.8-2.685a4.5 4.5 0 011.13-1.897l8.932-8.931zm0 0L19.5 7.125M18 14v4.75A2.25 2.25 0 0115.75 21H5.25A2.25 2.25 0 013 18.75V8.25A2.25 2.25 0 015.25 6H10" />
171-
</svg>
172-
<span class="flex-auto">Edit</span>
173-
</a>
174-
</li>
175-
<li>
176-
<button class="flex-auto" type="button" on:click={e => handleDeleteToken(e, item.item)}>
177-
<svg
178-
xmlns="http://www.w3.org/2000/svg"
179-
fill="none"
180-
viewBox="0 0 24 24"
181-
stroke-width="1.5"
182-
stroke="currentColor"
183-
class="w-6 h-6">
184-
<path
185-
stroke-linecap="round"
186-
stroke-linejoin="round"
187-
d="M14.74 9l-.346 9m-4.788 0L9.26 9m9.968-3.21c.342.052.682.107 1.022.166m-1.022-.165L18.16 19.673a2.25 2.25 0 01-2.244 2.077H8.084a2.25 2.25 0 01-2.244-2.077L4.772 5.79m14.456 0a48.108 48.108 0 00-3.478-.397m-12 .562c.34-.059.68-.114 1.022-.165m0 0a48.11 48.11 0 013.478-.397m7.5 0v-.916c0-1.18-.91-2.164-2.09-2.201a51.964 51.964 0 00-3.32 0c-1.18.037-2.09 1.022-2.09 2.201v.916m7.5 0a48.667 48.667 0 00-7.5 0" />
188-
</svg>
189-
<span class="flex-auto text-left">Delete</span>
190-
</button>
191-
</li>
192-
</ul>
193-
</nav>
194-
<div class="arrow bg-surface-100-800-token !left-[10.333rem]" />
195-
</div>
196-
</li>
197-
</div>
198-
{/each}
199-
</ul>
104+
{#if internalList?.length > 0}
105+
<ul
106+
class="list p-4 pt-3 pb-3"
107+
use:dndzone={{
108+
items: internalList,
109+
dragDisabled,
110+
flipDurationMs: flipAnimationMs,
111+
dropTargetStyle: {},
112+
transformDraggedElement,
113+
}}
114+
on:consider={handleConsider}
115+
on:finalize={handleFinalize}>
116+
{#each internalList as item (item.id)}
117+
{@const totp = item.item}
118+
<div animate:flip={{ duration: flipAnimationMs }}>
119+
<li class="h-14 p-1">
120+
<i
121+
class="material-icons drag-handle cursor-move"
122+
on:mousedown={startDrag}
123+
on:touchstart={startDrag}
124+
on:keydown={handleKeyDown}
125+
role="none">
126+
<svg
127+
viewBox="0 0 16 16"
128+
stroke-width="1.5"
129+
fill="currentColor"
130+
class="w-6 h-6"
131+
xmlns="http://www.w3.org/2000/svg">
132+
<path
133+
fill-rule="evenodd"
134+
d="M7.375 3.67c0-.645-.56-1.17-1.25-1.17s-1.25.525-1.25 1.17c0 .646.56 1.17 1.25 1.17s1.25-.524 1.25-1.17zm0 8.66c0-.646-.56-1.17-1.25-1.17s-1.25.524-1.25 1.17c0 .645.56 1.17 1.25 1.17s1.25-.525 1.25-1.17zm-1.25-5.5c.69 0 1.25.525 1.25 1.17 0 .645-.56 1.17-1.25 1.17S4.875 8.645 4.875 8c0-.645.56-1.17 1.25-1.17zm5-3.16c0-.645-.56-1.17-1.25-1.17s-1.25.525-1.25 1.17c0 .646.56 1.17 1.25 1.17s1.25-.524 1.25-1.17zm-1.25 7.49c.69 0 1.25.524 1.25 1.17 0 .645-.56 1.17-1.25 1.17s-1.25-.525-1.25-1.17c0-.646.56-1.17 1.25-1.17zM11.125 8c0-.645-.56-1.17-1.25-1.17s-1.25.525-1.25 1.17c0 .645.56 1.17 1.25 1.17s1.25-.525 1.25-1.17z" />
135+
</svg>
136+
</i>
137+
<img class="avatar-image h-full w-auto object-cover" src={getIcon(totp.name)} alt="icon" />
138+
<p class="flex-auto block min-w-0">
139+
<span class="block text-base truncate">{totp.name}</span>
140+
<span class="block text-sm uppercase">{totp.hashingAlgo}</span>
141+
</p>
142+
<button type="button" use:popup={getTotpItemMenuSettings(item.id)}>
143+
<svg
144+
xmlns="http://www.w3.org/2000/svg"
145+
fill="none"
146+
viewBox="0 0 24 24"
147+
stroke-width="1.5"
148+
stroke="currentColor"
149+
class="w-6 h-6">
150+
<path
151+
stroke-linecap="round"
152+
stroke-linejoin="round"
153+
d="M12 6.75a.75.75 0 110-1.5.75.75 0 010 1.5zM12 12.75a.75.75 0 110-1.5.75.75 0 010 1.5zM12 18.75a.75.75 0 110-1.5.75.75 0 010 1.5z" />
154+
</svg>
155+
</button>
156+
<div class="card p-4 w-48 shadow-md !transition-none !duration-0" data-popup="totpItemMenu_{item.id}">
157+
<nav class="list-nav">
158+
<ul>
159+
<li>
160+
<a class="flex-auto" href="/update/{item.item.id}">
161+
<svg
162+
xmlns="http://www.w3.org/2000/svg"
163+
fill="none"
164+
viewBox="0 0 24 24"
165+
stroke-width="1.5"
166+
stroke="currentColor"
167+
class="w-6 h-6">
168+
<path
169+
stroke-linecap="round"
170+
stroke-linejoin="round"
171+
d="M16.862 4.487l1.687-1.688a1.875 1.875 0 112.652 2.652L10.582 16.07a4.5 4.5 0 01-1.897 1.13L6 18l.8-2.685a4.5 4.5 0 011.13-1.897l8.932-8.931zm0 0L19.5 7.125M18 14v4.75A2.25 2.25 0 0115.75 21H5.25A2.25 2.25 0 013 18.75V8.25A2.25 2.25 0 015.25 6H10" />
172+
</svg>
173+
<span class="flex-auto">Edit</span>
174+
</a>
175+
</li>
176+
<li>
177+
<button class="flex-auto" type="button" on:click={e => handleDeleteToken(e, item.item)}>
178+
<svg
179+
xmlns="http://www.w3.org/2000/svg"
180+
fill="none"
181+
viewBox="0 0 24 24"
182+
stroke-width="1.5"
183+
stroke="currentColor"
184+
class="w-6 h-6">
185+
<path
186+
stroke-linecap="round"
187+
stroke-linejoin="round"
188+
d="M14.74 9l-.346 9m-4.788 0L9.26 9m9.968-3.21c.342.052.682.107 1.022.166m-1.022-.165L18.16 19.673a2.25 2.25 0 01-2.244 2.077H8.084a2.25 2.25 0 01-2.244-2.077L4.772 5.79m14.456 0a48.108 48.108 0 00-3.478-.397m-12 .562c.34-.059.68-.114 1.022-.165m0 0a48.11 48.11 0 013.478-.397m7.5 0v-.916c0-1.18-.91-2.164-2.09-2.201a51.964 51.964 0 00-3.32 0c-1.18.037-2.09 1.022-2.09 2.201v.916m7.5 0a48.667 48.667 0 00-7.5 0" />
189+
</svg>
190+
<span class="flex-auto text-left">Delete</span>
191+
</button>
192+
</li>
193+
</ul>
194+
</nav>
195+
<div class="arrow bg-surface-100-800-token !left-[10.333rem]" />
196+
</div>
197+
</li>
198+
</div>
199+
{/each}
200+
</ul>
201+
{:else}
202+
<div class="flex justify-center flex-col w-full h-full items-center">
203+
<h3 class="h3 block mb-5">Token list is empty</h3>
204+
<a class="btn variant-filled-primary btn-lg max-w-[15rem]" href="/update">
205+
<svg
206+
xmlns="http://www.w3.org/2000/svg"
207+
fill="none"
208+
viewBox="0 0 24 24"
209+
stroke-width="1.5"
210+
stroke="currentColor"
211+
class="w-6 h-6">
212+
<path stroke-linecap="round" stroke-linejoin="round" d="M12 4.5v15m7.5-7.5h-15" />
213+
</svg>
214+
<span>Add new token</span>
215+
</a>
216+
</div>
217+
{/if}

src/routes/+layout.svelte

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
import { AvailableTimezoneProviders } from '$lib/timezone-providers';
1515
import CommonPreloader from '$components/common-preloader/common-preloader.svelte';
1616
import Lightswitch from '$components/lightswitch/lightswitch.svelte';
17-
import LightswitchDemon from '$components/lightswitch/lightswitch-demon.svelte';
17+
import LightswitchDaemon from '$components/lightswitch/lightswitch-daemon.svelte';
1818
1919
initializeStores();
2020
@@ -29,7 +29,8 @@
2929
3030
$: $navigating && drawerStore.close();
3131
32-
$: classesActivePage = (href: string) => (href === $page.url.pathname ? '!bg-primary-500' : '');
32+
$: classesActivePage = (href: string) =>
33+
href === $page.url.pathname ? '!bg-primary-500 focus:!bg-primary-500' : 'focus:!bg-inherit';
3334
3435
async function closeTotpAppClient() {
3536
await SharedTotpAppClient.close();
@@ -87,7 +88,7 @@
8788
</script>
8889

8990
<svelte:window on:beforeunload={closeTotpAppClient} />
90-
<LightswitchDemon />
91+
<LightswitchDaemon />
9192

9293
{#if ready}
9394
<Modal />
@@ -97,7 +98,7 @@
9798
<nav class="list-nav p-2 h-full">
9899
<ul class="h-full flex flex-col">
99100
<li>
100-
<a href="/update" class="{classesActivePage('/update')} focus:!bg-inherit focus:!text-inherit">
101+
<a href="/update" class="{classesActivePage('/update')} focus:!text-inherit">
101102
<svg
102103
xmlns="http://www.w3.org/2000/svg"
103104
fill="none"

src/routes/update/[[id]]/+page.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
}
3939
4040
async function onScanQrCodeClicked() {
41-
GlobalPreloader.show('Looking for QR code');
41+
GlobalPreloader.show('Looking for QR code on a screen');
4242
// https://gist.github.com/kcramer/c6148fb906e116d84e4bde7b2ab56992
4343
scannedData = null;
4444
tokenInfo = null;

0 commit comments

Comments
 (0)