@@ -10,7 +11,7 @@
import { Button } from "$/components/ui/button";
import { LANDING_NAV_ITEMS, handleLandingNavClick } from ".";
- let { user, session }: LandingNavProps = $props();
+ let { user, session, loading }: LandingNavProps = $props();
let scrollY = $state(0);
const isFloating = $derived(scrollY > 50);
@@ -72,11 +73,15 @@
{#if fullyAuthenticated}
- Go to Dashboard
{:else if needs2FA}
{/if}
diff --git a/src/routes/+page.svelte b/src/routes/+page.svelte
index 8e15f779..d4f4ce77 100644
--- a/src/routes/+page.svelte
+++ b/src/routes/+page.svelte
@@ -14,14 +14,21 @@
import { getAuthUser } from "$/api/auth.remote";
import { onMount } from "svelte";
- let { user, session } = $state({
+ let { user, session, loading } = $state<
+ App.Locals & {
+ loading: boolean;
+ }
+ >({
user: null,
session: null,
+ loading: true,
});
onMount(() => {
try {
- getAuthUser().then((data) => ([user, session] = [data.user, data.session]));
+ getAuthUser()
+ .then((data) => ([user, session] = [data.user, data.session]))
+ .finally(() => (loading = false));
} catch (e) {
console.warn("Failed to fetch user data:", e);
}
@@ -29,11 +36,11 @@
-
+
-
+
@@ -62,12 +69,12 @@
-
+
-
+
diff --git a/src/routes/history/(components)/history-data-table-row-actions.svelte b/src/routes/history/(components)/history-data-table-row-actions.svelte
index d4b51918..2885ba47 100644
--- a/src/routes/history/(components)/history-data-table-row-actions.svelte
+++ b/src/routes/history/(components)/history-data-table-row-actions.svelte
@@ -57,7 +57,7 @@
},
{
label: "Date",
- value: row.original.date,
+ value: row.original.dateFormatted,
class: "font-mono",
},
{
@@ -167,7 +167,7 @@
Comprehensive billing information for
- {row.original.date}
+ {row.original.dateFormatted}
@@ -257,7 +257,7 @@
- Edit billing info of {row.original.date}
+ Edit billing info of {row.original.dateFormatted}
Update the billing info details for billing info with id
diff --git a/src/routes/history/(components)/index.ts b/src/routes/history/(components)/index.ts
index 1a297941..b8b0d1d2 100644
--- a/src/routes/history/(components)/index.ts
+++ b/src/routes/history/(components)/index.ts
@@ -5,7 +5,7 @@ import type { ExtendedBillingInfoTableView } from "$/types/billing-info";
import type { ColumnDef, Table } from "@tanstack/table-core";
import { createRawSnippet } from "svelte";
import { HistoryDataTableRowActions, SubPaymentsButton } from ".";
-import { formatNumber } from "$/utils/format";
+import { formatDate, formatNumber } from "$/utils/format";
export function historyTableColumns() {
return [
@@ -30,7 +30,7 @@ export function historyTableColumns() {
enableHiding: false,
},
{
- accessorKey: "dateFormatted",
+ accessorKey: "date",
header: ({ column }) =>
renderComponent(DataTableColumnHeader, {
column,
@@ -45,7 +45,7 @@ export function historyTableColumns() {
}),
}),
filterFn: (row, id, value) => {
- const dateStr = row.getValue(id) as string;
+ const dateStr = formatDate(row.getValue(id)) as string;
return dateStr === value || dateStr.toLowerCase().includes(value.toLowerCase());
},
},
diff --git a/src/routes/history/(components)/sub-payments-dialog.svelte b/src/routes/history/(components)/sub-payments-dialog.svelte
index c369f2a5..fe087aa9 100644
--- a/src/routes/history/(components)/sub-payments-dialog.svelte
+++ b/src/routes/history/(components)/sub-payments-dialog.svelte
@@ -20,7 +20,7 @@