Skip to content

Commit 7ffcd39

Browse files
committed
refac
1 parent 0dcd6ac commit 7ffcd39

1 file changed

Lines changed: 43 additions & 33 deletions

File tree

src/lib/components/layout/Sidebar/UserMenu.svelte

Lines changed: 43 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -237,39 +237,49 @@
237237

238238
{#if role === 'admin'}
239239
<a
240-
href="/playground"
241-
draggable="false"
242-
class="flex rounded-xl py-1.5 px-3 w-full hover:bg-gray-50 dark:hover:bg-gray-800 transition cursor-pointer select-none"
243-
on:click={async () => {
244-
show = false;
245-
if ($mobile) {
246-
await tick();
247-
showSidebar.set(false);
248-
}
249-
}}
250-
>
251-
<div class=" self-center mr-3">
252-
<Code className="size-5" strokeWidth="1.5" />
253-
</div>
254-
<div class=" self-center truncate">{$i18n.t('Playground')}</div>
255-
</a>
256-
<a
257-
href="/admin"
258-
draggable="false"
259-
class="flex rounded-xl py-1.5 px-3 w-full hover:bg-gray-50 dark:hover:bg-gray-800 transition cursor-pointer select-none"
260-
on:click={async () => {
261-
show = false;
262-
if ($mobile) {
263-
await tick();
264-
showSidebar.set(false);
265-
}
266-
}}
267-
>
268-
<div class=" self-center mr-3">
269-
<UserGroup className="w-5 h-5" strokeWidth="1.5" />
270-
</div>
271-
<div class=" self-center truncate">{$i18n.t('Admin Panel')}</div>
272-
</a>
240+
href="/playground"
241+
draggable="false"
242+
class="flex rounded-xl py-1.5 px-3 w-full hover:bg-gray-50 dark:hover:bg-gray-800 transition cursor-pointer select-none"
243+
on:click={async (e) => {
244+
if (e.metaKey || e.ctrlKey || e.shiftKey || e.button === 1) {
245+
return;
246+
}
247+
e.preventDefault();
248+
show = false;
249+
goto('/playground');
250+
if ($mobile) {
251+
await tick();
252+
showSidebar.set(false);
253+
}
254+
}}
255+
>
256+
<div class=" self-center mr-3">
257+
<Code className="size-5" strokeWidth="1.5" />
258+
</div>
259+
<div class=" self-center truncate">{$i18n.t('Playground')}</div>
260+
</a>
261+
<a
262+
href="/admin"
263+
draggable="false"
264+
class="flex rounded-xl py-1.5 px-3 w-full hover:bg-gray-50 dark:hover:bg-gray-800 transition cursor-pointer select-none"
265+
on:click={async (e) => {
266+
if (e.metaKey || e.ctrlKey || e.shiftKey || e.button === 1) {
267+
return;
268+
}
269+
e.preventDefault();
270+
show = false;
271+
goto('/admin');
272+
if ($mobile) {
273+
await tick();
274+
showSidebar.set(false);
275+
}
276+
}}
277+
>
278+
<div class=" self-center mr-3">
279+
<UserGroup className="w-5 h-5" strokeWidth="1.5" />
280+
</div>
281+
<div class=" self-center truncate">{$i18n.t('Admin Panel')}</div>
282+
</a>
273283
{/if}
274284

275285
{#if help}

0 commit comments

Comments
 (0)