Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
56aece3
commit eae7d2f
Showing
17 changed files
with
299 additions
and
82 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@siafoundation/react-renterd': minor | ||
--- | ||
|
||
useObjectDirectory now supports prefix filtering. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'renterd': minor | ||
--- | ||
|
||
File warnings are now a simple warning icon next to the stats and are explained in a popover. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'renterd': minor | ||
--- | ||
|
||
Selecting a file search result now navigates to the directory and applies a file name filter. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'renterd': minor | ||
--- | ||
|
||
The bucket empty state now has a button for navigating back to the buckets list. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'renterd': minor | ||
--- | ||
|
||
Files in the current directory can now be filtered. |
22 changes: 18 additions & 4 deletions
22
apps/renterd/components/Files/EmptyState/StateNoneMatching.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,29 @@ | ||
import { Text } from '@siafoundation/design-system' | ||
import { Button, Text } from '@siafoundation/design-system' | ||
import { Filter32 } from '@siafoundation/react-icons' | ||
import { useFiles } from '../../../contexts/files' | ||
|
||
export function StateNoneMatching() { | ||
const { filters, resetFilters } = useFiles() | ||
return ( | ||
<div className="flex flex-col gap-10 justify-center items-center h-[400px]"> | ||
<Text> | ||
<Filter32 className="scale-[200%]" /> | ||
</Text> | ||
<Text color="subtle" className="text-center max-w-[500px]"> | ||
No files matching filters. | ||
</Text> | ||
<div className="flex flex-col gap-3 items-center"> | ||
<Text color="subtle" className="text-center max-w-[500px]"> | ||
No files matching filters. | ||
</Text> | ||
{!!filters.length && ( | ||
<Button | ||
onClick={(e) => { | ||
e.stopPropagation() | ||
resetFilters() | ||
}} | ||
> | ||
Clear filters | ||
</Button> | ||
)} | ||
</div> | ||
</div> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,29 @@ | ||
import { Text } from '@siafoundation/design-system' | ||
import { Code, LinkButton, Text } from '@siafoundation/design-system' | ||
import { CloudUpload32 } from '@siafoundation/react-icons' | ||
import { routes } from '../../../config/routes' | ||
import { useFiles } from '../../../contexts/files' | ||
|
||
export function StateNoneYet() { | ||
const { activeBucket } = useFiles() | ||
return ( | ||
<div className="flex flex-col gap-10 justify-center items-center h-[400px] cursor-pointer"> | ||
<Text> | ||
<CloudUpload32 className="scale-[200%]" /> | ||
</Text> | ||
<Text color="subtle" className="text-center max-w-[500px]"> | ||
No files, drag and drop files or click here to start uploading. | ||
</Text> | ||
<div className="flex flex-col gap-3 items-center"> | ||
<Text color="subtle" className="text-center max-w-[500px]"> | ||
The <Code>{activeBucket}</Code> bucket does not contain any files, | ||
drag and drop files or click here to start uploading. | ||
</Text> | ||
<LinkButton | ||
href={routes.files.index} | ||
onClick={(e) => { | ||
e.stopPropagation() | ||
}} | ||
> | ||
View buckets list | ||
</LinkButton> | ||
</div> | ||
</div> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 56 additions & 0 deletions
56
apps/renterd/components/Files/FilesFilterDirectoryMenu/index.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
import { Button, Separator, TextField } from '@siafoundation/design-system' | ||
import { useEffect, useState } from 'react' | ||
import { useFiles } from '../../../contexts/files' | ||
import { useDebounce } from 'use-debounce' | ||
import { Close16 } from '@siafoundation/react-icons' | ||
|
||
export function FilesFilterDirectoryMenu() { | ||
const { filters, setFilter, removeFilter } = useFiles() | ||
const [search, setSearch] = useState('') | ||
const [debouncedSearch] = useDebounce(search, 500) | ||
|
||
useEffect(() => { | ||
const fileNamePrefixFilter = filters.find((f) => f.id === 'fileNamePrefix') | ||
const fileNamePrefix = fileNamePrefixFilter?.value || '' | ||
if (fileNamePrefix !== search) { | ||
setSearch(fileNamePrefix) | ||
} | ||
// eslint-disable-next-line react-hooks/exhaustive-deps | ||
}, [setSearch, filters]) | ||
|
||
useEffect(() => { | ||
if (debouncedSearch.length) { | ||
setFilter({ | ||
id: 'fileNamePrefix', | ||
label: '', | ||
value: debouncedSearch, | ||
}) | ||
} else { | ||
removeFilter('fileNamePrefix') | ||
} | ||
// eslint-disable-next-line react-hooks/exhaustive-deps | ||
}, [debouncedSearch]) | ||
|
||
console.log('hi') | ||
|
||
return ( | ||
<div className="flex gap-1 flex-1"> | ||
<TextField | ||
variant="ghost" | ||
focus="none" | ||
placeholder="Filter files in current directory" | ||
value={search} | ||
onChange={(e) => setSearch(e.currentTarget.value)} | ||
className="w-full" | ||
/> | ||
{!!search.length && ( | ||
<> | ||
<Button variant="ghost" onClick={() => setSearch('')}> | ||
<Close16 /> | ||
</Button> | ||
<Separator variant="vertical" className="h-full" /> | ||
</> | ||
)} | ||
</div> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
60 changes: 39 additions & 21 deletions
60
apps/renterd/components/Files/FilesStatsMenu/FilesStatsMenuWarnings.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,54 @@ | ||
import { Text, Tooltip } from '@siafoundation/design-system' | ||
import { | ||
Button, | ||
Paragraph, | ||
Popover, | ||
Separator, | ||
Text, | ||
} from '@siafoundation/design-system' | ||
import { Warning16 } from '@siafoundation/react-icons' | ||
import { useContractSetMismatch } from '../checks/useContractSetMismatch' | ||
import { useMemo } from 'react' | ||
|
||
export function FilesStatsMenuWarnings() { | ||
const contractSetMismatch = useContractSetMismatch() | ||
|
||
// warn about contract set mismatch | ||
if (contractSetMismatch.active) { | ||
return ( | ||
<Tooltip | ||
align="start" | ||
content={ | ||
<> | ||
const contractSetMismatchEl = useMemo(() => { | ||
// warn about contract set mismatch | ||
if (contractSetMismatch.active) { | ||
return ( | ||
<div className="flex flex-col gap-2"> | ||
<Text size="12" font="mono" weight="medium" color="amber"> | ||
Uploaded data will not be managed by autopilot. | ||
</Text> | ||
<Paragraph size="12"> | ||
The autopilot contract set does not match the default contract set. | ||
This means that by default workers will not upload data to contracts | ||
that autopilot manages. Unless these contract are being manually | ||
maintained, this will result in data loss. Continue with caution or | ||
update the autopilot contract set to match the default contract set. | ||
</> | ||
} | ||
> | ||
<div className="flex gap-1"> | ||
<Text size="12" font="mono" weight="medium" color="amber"> | ||
<Warning16 /> | ||
</Text> | ||
<Text size="12" font="mono" weight="medium" color="amber"> | ||
Uploaded data will not be managed by autopilot. | ||
</Text> | ||
</Paragraph> | ||
</div> | ||
</Tooltip> | ||
) | ||
) | ||
} | ||
return null | ||
}, [contractSetMismatch.active]) | ||
|
||
if (!contractSetMismatchEl) { | ||
return null | ||
} | ||
|
||
return null | ||
return ( | ||
<> | ||
<Popover | ||
trigger={ | ||
<Button variant="ghost" icon="contrast" color="amber"> | ||
<Warning16 /> | ||
</Button> | ||
} | ||
> | ||
<div className="px-1 py-2">{contractSetMismatchEl}</div> | ||
</Popover> | ||
<Separator variant="vertical" className="h-full" /> | ||
</> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.