feat: polish

This commit is contained in:
2024-03-13 08:40:18 +07:00
parent ccab78ca11
commit e928f2ee37
10 changed files with 65 additions and 163 deletions

View File

@@ -46,6 +46,7 @@ function App() {
</button>
<button
type="button"
onClick={() => ark.open_settings()}
className="inline-flex size-8 items-center justify-center rounded-full bg-neutral-200 text-neutral-800 hover:bg-neutral-400 dark:bg-neutral-800 dark:text-neutral-200 dark:hover:bg-neutral-600"
>
<HorizontalDotsIcon className="size-5" />

View File

@@ -1,4 +1,4 @@
import { GlobalIcon, LocalIcon, RefreshIcon } from "@lume/icons";
import { GlobalIcon, LoaderIcon, LocalIcon, RefreshIcon } from "@lume/icons";
import { cn } from "@lume/utils";
import { useQueryClient } from "@tanstack/react-query";
import { Link } from "@tanstack/react-router";

View File

@@ -6,7 +6,7 @@ import { createFileRoute, redirect, useNavigate } from "@tanstack/react-router";
import { useState } from "react";
export const Route = createFileRoute("/")({
beforeLoad: async ({ context }) => {
beforeLoad: async ({ search, context }) => {
const ark = context.ark;
const accounts = await ark.get_all_accounts();
@@ -22,9 +22,13 @@ export const Route = createFileRoute("/")({
});
// Only 1 account, skip account selection screen
case 1:
// @ts-ignore, totally fine !!!
if (search.manually) return;
const account = accounts[0].npub;
const loadAccount = await ark.load_selected_account(account);
if (loadAccount) {
const loadedAccount = await ark.load_selected_account(account);
if (loadedAccount) {
throw redirect({
to: "/$account/home/local",
params: { account },
@@ -72,7 +76,9 @@ function Screen() {
</div>
<div className="flex items-center justify-center gap-6">
{loading ? (
<LoaderIcon className="size-6 animate-spin text-white" />
<div className="inline-flex size-6 items-center justify-center">
<LoaderIcon className="size-6 animate-spin text-white" />
</div>
) : (
<>
{ark.accounts.map((account) => (