feat: add umami analytics
This commit is contained in:
parent
448dde62f7
commit
533866a1f2
7 changed files with 53 additions and 20 deletions
|
@ -37,7 +37,7 @@ export const Home: Component<RouteSectionProps> = () => {
|
|||
const [loadingProgress, setLoadingProgress] = createSignal<number>();
|
||||
// const [isLoadingDatabase, setIsLoadingDatabase] = createSignal(false);
|
||||
|
||||
const onSubmit: JSX.EventHandler<HTMLFormElement, SubmitEvent> = async (event) => {
|
||||
const onSubmit: JSX.EventHandler<HTMLFormElement, SubmitEvent> = (event) => {
|
||||
event.preventDefault();
|
||||
|
||||
const currentBackupFile = backupFile();
|
||||
|
@ -53,22 +53,24 @@ export const Home: Component<RouteSectionProps> = () => {
|
|||
|
||||
// setDbHash(hash);
|
||||
|
||||
try {
|
||||
const decrypted = await decryptBackup(currentBackupFile, currentPassphrase, setDecryptionProgress);
|
||||
decryptBackup(currentBackupFile, currentPassphrase, setDecryptionProgress)
|
||||
.then(async (decrypted) => {
|
||||
umami.track("Decrypt backup");
|
||||
setDecryptionProgress(undefined);
|
||||
// setIsLoadingDatabase(true);
|
||||
setLoadingProgress(0);
|
||||
|
||||
setDecryptionProgress(undefined);
|
||||
// setIsLoadingDatabase(true);
|
||||
setLoadingProgress(0);
|
||||
await loadDb(decrypted.database_statements, setLoadingProgress);
|
||||
umami.track("Load database");
|
||||
|
||||
await loadDb(decrypted.database_statements, setLoadingProgress);
|
||||
// setIsLoadingDatabase(false);
|
||||
setLoadingProgress(undefined);
|
||||
|
||||
// setIsLoadingDatabase(false);
|
||||
setLoadingProgress(undefined);
|
||||
|
||||
navigate("/overview");
|
||||
} catch (error) {
|
||||
console.error("Decryption failed:", error);
|
||||
}
|
||||
navigate("/overview");
|
||||
})
|
||||
.catch((error) => {
|
||||
console.error("Decryption failed:", error);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -94,6 +94,7 @@ export const columns = [
|
|||
<Button
|
||||
variant="ghost"
|
||||
onClick={() => {
|
||||
umami.track("Sort overview table");
|
||||
props.column.toggleSorting();
|
||||
}}
|
||||
>
|
||||
|
@ -144,6 +145,7 @@ export const columns = [
|
|||
<Button
|
||||
variant="ghost"
|
||||
onClick={() => {
|
||||
umami.track("Sort overview table");
|
||||
props.column.toggleSorting();
|
||||
}}
|
||||
>
|
||||
|
@ -162,6 +164,7 @@ export const columns = [
|
|||
<Button
|
||||
variant="ghost"
|
||||
onClick={() => {
|
||||
umami.track("Sort overview table");
|
||||
props.column.toggleSorting();
|
||||
}}
|
||||
>
|
||||
|
@ -269,7 +272,10 @@ export const OverviewTable = (props: OverviewTableProps) => {
|
|||
<div class="flex items-center py-4">
|
||||
<TextField
|
||||
value={(table.getColumn("name")?.getFilterValue() as string | undefined) ?? ""}
|
||||
onChange={(value) => table.getColumn("name")?.setFilterValue(value)}
|
||||
onChange={(value) => {
|
||||
umami.track("Filter overview table");
|
||||
table.getColumn("name")?.setFilterValue(value);
|
||||
}}
|
||||
>
|
||||
<TextFieldInput placeholder="Filter by name..." class="max-w-sm" />
|
||||
</TextField>
|
||||
|
@ -278,7 +284,10 @@ export const OverviewTable = (props: OverviewTableProps) => {
|
|||
<Checkbox
|
||||
id="show-archived"
|
||||
checked={(table.getColumn("archived")?.getFilterValue() as boolean | undefined) ?? false}
|
||||
onChange={(value) => table.getColumn("archived")?.setFilterValue(value)}
|
||||
onChange={(value) => {
|
||||
umami.track("Filter overview table");
|
||||
table.getColumn("archived")?.setFilterValue(value);
|
||||
}}
|
||||
/>
|
||||
<div class="grid gap-1.5 leading-none">
|
||||
<Label for="show-archived">Show archived chats</Label>
|
||||
|
@ -288,7 +297,10 @@ export const OverviewTable = (props: OverviewTableProps) => {
|
|||
<Checkbox
|
||||
id="show-groups"
|
||||
checked={(table.getColumn("isGroup")?.getFilterValue() as boolean | undefined) ?? false}
|
||||
onChange={(value) => table.getColumn("isGroup")?.setFilterValue(value)}
|
||||
onChange={(value) => {
|
||||
umami.track("Filter overview table");
|
||||
table.getColumn("isGroup")?.setFilterValue(value);
|
||||
}}
|
||||
/>
|
||||
<div class="grid gap-1.5 leading-none">
|
||||
<Label for="show-groups">Show group chats (detailed analysis not implemented)</Label>
|
||||
|
@ -347,7 +359,7 @@ export const OverviewTable = (props: OverviewTableProps) => {
|
|||
preload(`/${isGroup ? "group" : "dm"}/${threadId.toString()}`, {
|
||||
preloadData: true,
|
||||
});
|
||||
}, 20);
|
||||
}, 50);
|
||||
|
||||
event.currentTarget.addEventListener(
|
||||
"pointerout",
|
||||
|
@ -365,6 +377,7 @@ export const OverviewTable = (props: OverviewTableProps) => {
|
|||
const isGroup = row.original.isGroup;
|
||||
|
||||
if (rowIsAvailable(threadId)) {
|
||||
umami.track("Load chat statistics");
|
||||
navigate(`/${isGroup ? "group" : "dm"}/${threadId.toString()}`);
|
||||
}
|
||||
}}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue