Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
86 changes: 82 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,15 @@
"class-variance-authority": "^0.7.1",
"clsx": "^2.1.1",
"filesize": "^11.0.13",
"i18next": "^26.0.6",
"immer": "^10.2.0",
"lucide-react": "^0.548.0",
"next-themes": "^0.4.6",
"radix-ui": "^1.4.3",
"react": "^18.3.1",
"react-arborist": "^3.4.3",
"react-dom": "^18.3.1",
"react-i18next": "^17.0.4",
"recharts": "^2.15.4",
"sonner": "^2.0.7",
"tailwind-merge": "^3.3.1",
Expand Down
35 changes: 14 additions & 21 deletions src/components/CustomPathCard.tsx
Original file line number Diff line number Diff line change
@@ -1,32 +1,25 @@
import React, { useState, useEffect } from 'react'
import { Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle } from './ui/card'
import DiskPath from './disk_path'
import React, { useState } from 'react'
import { Card, CardContent, CardFooter, CardHeader, CardTitle } from './ui/card'
import { Separator } from '@/components/ui/separator'
import CustomPath from './custom_path'
import { Button } from './ui/button'
import { Checkbox } from './ui/checkbox'
import { Label } from '@/components/ui/label'

import { invoke } from '@tauri-apps/api/core';
import { snapshotStore, useErrorStore, userStore } from './store'
import { DataTable } from './data_table'
import { SnapshotFile } from './data_table_columns'

import { columns } from './data_table_columns'
import { RowSelectionState } from '@tanstack/react-table'
import { useErrorStore, userStore } from './store'
import Progress from './progress'

import DeltaLogo from '../../src-tauri/icons/64x64.png'
import { DirView, InitDisk } from '@/types'
import TopBar from './top-bar'
import { ScanTabs } from './ScanTabs'
import { DirView } from '@/types'
import { useTranslation } from 'react-i18next'

interface SplashPageProps {
setWhichField: React.Dispatch<React.SetStateAction<boolean>>;
}


const CustomPathCard: React.FC<SplashPageProps> = ({ setWhichField }) => {
const { t } = useTranslation()

// Card only needs to read the currently selected snapshot file global store obj?
const [selectedPath, setSelectedPath] = useState<string>("");
Expand Down Expand Up @@ -54,11 +47,11 @@ const CustomPathCard: React.FC<SplashPageProps> = ({ setWhichField }) => {
return (
<Card className='w-[28rem] p-7'>
<CardHeader>
<CardTitle>Start Snapshot</CardTitle>
<CardTitle>{t("scan.title")}</CardTitle>
</CardHeader>
<CardContent>
<div className="flex flex-col space-y-5">
<p className="text-sm leading-none font-medium">Custom Path</p>
<p className="text-sm leading-none font-medium">{t("scan.fields.customPath")}</p>
<CustomPath value={selectedPath} onChange={setSelectedPath} />

<Separator></Separator>
Expand All @@ -67,9 +60,9 @@ const CustomPathCard: React.FC<SplashPageProps> = ({ setWhichField }) => {
<div className="flex items-start gap-3">
<Checkbox id="terms-2" checked={false} disabled={true}></Checkbox>
<div className="grid gap-2">
<Label htmlFor="terms-2">Compare Snapshots</Label>
<Label htmlFor="terms-2">{t("scan.options.compareSnapshots")}</Label>
<p className="text-muted-foreground text-sm">
Compare current scan with previous scanned snapshot
{t("scan.options.compareSnapshotsDescription")}
</p>
</div>
</div>
Expand All @@ -79,9 +72,9 @@ const CustomPathCard: React.FC<SplashPageProps> = ({ setWhichField }) => {
<div className="flex items-start gap-3">
<Checkbox id="terms-2" checked={false} disabled={true}></Checkbox>
<div className="grid gap-2">
<Label htmlFor="terms-2">Save Snapshot</Label>
<Label htmlFor="terms-2">{t("scan.options.saveSnapshot")}</Label>
<p className="text-muted-foreground text-sm">
Save current scan into new snapshot file
{t("scan.options.saveSnapshotDescription")}
</p>
</div>
</div>
Expand All @@ -90,12 +83,12 @@ const CustomPathCard: React.FC<SplashPageProps> = ({ setWhichField }) => {
</CardContent>
<CardFooter>
<div className="w-full flex flex-row items-center justify-center gap-3">
<Button variant="outline" onClick={() => runScan(selectedPath)}>Scan</Button>
<Button variant="outline" onClick={() => runScan(selectedPath)}>{t("scan.actions.scan")}</Button>
<Progress></Progress>
</div>
</CardFooter>
</Card>
)
}

export default CustomPathCard
export default CustomPathCard
22 changes: 12 additions & 10 deletions src/components/FullDiskCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import { snapshotStore, useErrorStore, userStore } from './store'
import Progress from './progress'

import { DirView, InitDisk } from '@/types'
import { useTranslation } from 'react-i18next'


interface SplashPageProps {
Expand All @@ -21,6 +22,7 @@ interface SplashPageProps {


const FullDiskCard: React.FC<SplashPageProps> = ({ setWhichField }) => {
const { t } = useTranslation()

const [disks, setDisks] = useState<InitDisk[]>([]);

Expand All @@ -46,12 +48,12 @@ const FullDiskCard: React.FC<SplashPageProps> = ({ setWhichField }) => {

} catch (err) {
setCurrentBackendError(err)
setDisks([{ name: "Unknown", desc: "No Disks Found" }])
setDisks([{ name: t("scan.fallback.unknownDisk"), desc: t("scan.fallback.noDisksFound") }])
}
}

getDisks();
}, []);
}, [setCurrentBackendError, t]);

const runScan = async (target: string) => {
try {
Expand Down Expand Up @@ -81,11 +83,11 @@ const FullDiskCard: React.FC<SplashPageProps> = ({ setWhichField }) => {
return (
<Card className='w-[28rem] p-7'>
<CardHeader>
<CardTitle>Start Snapshot</CardTitle>
<CardTitle>{t("scan.title")}</CardTitle>
</CardHeader>
<CardContent>
<div className="flex flex-col space-y-5">
<p className="text-sm leading-none font-medium">Disk</p>
<p className="text-sm leading-none font-medium">{t("scan.fields.disk")}</p>
<DiskPath disks={disks} onValueChange={setSelectedDisk}></DiskPath>

<Separator></Separator>
Expand All @@ -94,9 +96,9 @@ const FullDiskCard: React.FC<SplashPageProps> = ({ setWhichField }) => {
<div className="flex items-start gap-3">
<Checkbox id="terms-2" disabled={snapshotFile === ""} checked={snapshotFlag} onCheckedChange={setSnapshotFlag} />
<div className="grid gap-2">
<Label htmlFor="terms-2">Compare Snapshots</Label>
<Label htmlFor="terms-2">{t("scan.options.compareSnapshots")}</Label>
<p className="text-muted-foreground text-sm">
Compare current scan with previous scanned snapshot
{t("scan.options.compareSnapshotsDescription")}
</p>
</div>
</div>
Expand All @@ -106,22 +108,22 @@ const FullDiskCard: React.FC<SplashPageProps> = ({ setWhichField }) => {
<div className="flex items-start gap-3">
<Checkbox id="terms-2" checked={saveCurrentSnapshotFlag} onCheckedChange={(checked) => setSaveCurrentSnapshotFlag(checked === true)} /*<-- Typescript type check shi*/ />
<div className="grid gap-2">
<Label htmlFor="terms-2">Save Snapshot</Label>
<Label htmlFor="terms-2">{t("scan.options.saveSnapshot")}</Label>
<p className="text-muted-foreground text-sm">
Save current scan into new snapshot file
{t("scan.options.saveSnapshotDescription")}
</p>
</div>
</div>
</div>
</CardContent>
<CardFooter>
<div className="w-full flex flex-row items-center justify-center gap-3">
<Button variant="outline" onClick={() => runScan(selectedDisk)}>Scan</Button>
<Button variant="outline" onClick={() => runScan(selectedDisk)}>{t("scan.actions.scan")}</Button>
<Progress></Progress>
</div>
</CardFooter>
</Card>
)
}

export default FullDiskCard
export default FullDiskCard
6 changes: 4 additions & 2 deletions src/components/HistoryToggle.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,21 @@ import { Label } from "@/components/ui/label"
import { Switch } from "@/components/ui/switch"
import { useConfigurationStore } from "./store"
import { Activity } from "lucide-react"
import { useTranslation } from "react-i18next"

export function HistoryToggle() {
const { t } = useTranslation()
const setShowHistory = useConfigurationStore((state) => state.setShowHistory)
const showHistoryFlag = useConfigurationStore((state) => state.ShowHistory)

return (
<div className="flex flex-row items-center justify-between rounded-lg border bg-card p-4 shadow-sm">
<div className="space-y-1">
<Label htmlFor="history-mode" className="text-base font-medium flex items-center gap-2">
History Graph
{t("settings.historyGraph")}
</Label>
<p className="text-[0.8rem] text-muted-foreground">
Enable the historical size graph when viewing directory entries.
{t("settings.historyGraphDescription")}
</p>
</div>
<Switch
Expand Down
10 changes: 6 additions & 4 deletions src/components/NotificationCenter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@ import {
import { ScrollArea } from "@/components/ui/scroll-area"
import { useErrorStore } from "./store"
import { useEffect, useState } from "react"
import { useTranslation } from "react-i18next"

export function NotificationCenter() {
const { t } = useTranslation()
const backendErrorList = useErrorStore((state) => state.currentBackendErrors)

const [unreadCount, setUnreadCount] = useState(0)
Expand Down Expand Up @@ -48,11 +50,11 @@ export function NotificationCenter() {
{unreadCount}
</Badge>
)}
<span className="sr-only">Toggle notifications</span>
<span className="sr-only">{t("notifications.toggle")}</span>
</Button>
</PopoverTrigger>
<PopoverContent className="w-80 p-0" align="center">
<div className="p-2 font-medium text-sm">Notifications</div>
<div className="p-2 font-medium text-sm">{t("notifications.title")}</div>
<ScrollArea className="h-[375px]">
<div className="flex flex-col gap-1 p-2">
{backendErrorList.map((notification, index) => (
Expand All @@ -61,7 +63,7 @@ export function NotificationCenter() {
className="flex flex-col gap-1 rounded-md p-3 text-xs transition-colors hover:bg-muted/50 bg-muted/20 border border-red-500/30 overflow-hidden"
>
<div className="text-sm font-bold text-red-600 dark:text-red-400 break-all">
{`Error: ${notification.err_code}`}
{t("notifications.errorCode", { code: notification.err_code })}
</div>
{notification.library_generated_error_desc?.toLowerCase() !== "n/a" && (
<div className="font-medium text-[12px] text-foreground leading-tight break-words">
Expand All @@ -80,4 +82,4 @@ export function NotificationCenter() {
</PopoverContent>
</Popover>
)
}
}
Loading