Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: resolve various warnings #772

Merged
merged 1 commit into from
Oct 11, 2024
Merged
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
5 changes: 5 additions & 0 deletions .changeset/eight-kids-cheer.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'website': patch
---

Added a max height and radius for hosts on the host map.
5 changes: 5 additions & 0 deletions .changeset/five-bobcats-grin.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@siafoundation/design-system': minor
---

The Dialog now supports providing a title or description that is visually hidden but still announced by assistive technology.
5 changes: 5 additions & 0 deletions .changeset/late-drinks-protect.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'website': patch
---

Fixed hydration mismatch warnings related to the random selection of a host on the globe.
5 changes: 5 additions & 0 deletions .changeset/late-readers-play.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'renterd': patch
---

Fixed an issue with the uploads list loading and empty states.
5 changes: 5 additions & 0 deletions .changeset/mean-zebras-impress.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@siafoundation/design-system': patch
---

Fixed a warning caused by animation props being passed to non-animated graphs.
5 changes: 5 additions & 0 deletions .changeset/perfect-nails-tell.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'website': patch
---

Fixed a hydration mismatch warning related to the ThemeRadio in footer.
5 changes: 5 additions & 0 deletions .changeset/quick-horses-love.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@siafoundation/design-system': minor
---

Adjusted tooltip to only wrap content with Paragraph if prop is a string or React.Fragment.
5 changes: 5 additions & 0 deletions .changeset/red-kangaroos-nail.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'walletd': patch
---

Fixed an issue where the app would try to fetch from an invalid URL when first initializing.
6 changes: 6 additions & 0 deletions .changeset/six-cougars-sell.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'hostd': patch
'renterd': patch
---

Added explicit aria descriptions to some primary dialogs.
5 changes: 5 additions & 0 deletions .changeset/stale-windows-walk.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@siafoundation/design-system': patch
---

Fixed a 1 pixel gap that would show between the top of the Table and its sticky header when scrolling.
5 changes: 5 additions & 0 deletions .changeset/sweet-timers-fry.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@siafoundation/design-system': patch
---

Fixed warnings caused by the Dialog description prop and aria-describedby.
2 changes: 1 addition & 1 deletion apps/hostd/contexts/volumes/columns.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export const columns: VolumesTableColumn[] = [
'available'
) : (
<>
<Text>unavailable</Text>
<Text size="12">unavailable</Text>
<div className="flex flex-col">
{data.errors?.map((reason) => (
<Text key={reason} size="10" noWrap>
Expand Down
6 changes: 1 addition & 5 deletions apps/hostd/dialogs/VolumeCreateDialog.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import {
Paragraph,
Dialog,
GBToSectors,
triggerErrorToast,
Expand Down Expand Up @@ -211,6 +210,7 @@ export function VolumeCreateDialog({ trigger, open, onOpenChange }: Props) {
return (
<Dialog
title="Create Volume"
description="Create a new volume. Select a system directory and specific the size of the volume."
trigger={trigger}
open={open}
onOpenChange={(val) => {
Expand All @@ -230,10 +230,6 @@ export function VolumeCreateDialog({ trigger, open, onOpenChange }: Props) {
}
>
<div className="flex flex-col gap-4">
<Paragraph size="14">
Create a new volume. Select a system directory and specific the size
of the volume.
</Paragraph>
<FieldText name="name" form={form} fields={fields} />
<div className="flex flex-col gap-3">
<div className="flex flex-col gap-1">
Expand Down
2 changes: 1 addition & 1 deletion apps/renterd/components/Contracts/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ export function Contracts() {
height: listHeight,
}}
>
<ScrollArea className="z-0" id="scroll-hosts">
<ScrollArea className="z-0">
<div
className={cx(showDetailView ? 'pb-6 px-6' : 'p-6', 'min-w-fit')}
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ export function FilesStatsMenuSize() {
<Tooltip
side="bottom"
content={
<Text className="flex justify-between gap-6">
<Text className="flex flex-col gap-1">
<div className="flex justify-between gap-6">
<div className="flex flex-col gap-1">
<Text size="12" color="subtle">
size of all files
</Text>
Expand All @@ -53,8 +53,8 @@ export function FilesStatsMenuSize() {
<Text size="12" color="subtle">
total storage utilization
</Text>
</Text>
<Text className="flex flex-col gap-1 items-end">
</div>
<div className="flex flex-col gap-1 items-end">
<Text size="12">{humanBytes(stats.data.totalObjectsSize)}</Text>
<Text size="12">{humanBytes(stats.data.totalSectorsSize)}</Text>
{!!averageRedundancyFactor && (
Expand All @@ -64,8 +64,8 @@ export function FilesStatsMenuSize() {
)}
<Separator className="w-full my-1" />
<Text size="12">{humanBytes(stats.data.totalUploadedSize)}</Text>
</Text>
</Text>
</div>
</div>
}
>
<Text size="12" font="mono">
Expand Down
36 changes: 26 additions & 10 deletions apps/renterd/components/Hosts/HostMap/HostItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -90,26 +90,42 @@ export function HostItem({
<Tooltip
content={
<div className="flex flex-col gap-1">
<Text color="contrast" weight="bold">
<Text size="12" color="contrast" weight="bold">
{countryCodeEmoji(host.country_code)} {host.country_code}
</Text>
<div className="flex gap-2">
<div className="flex flex-col gap-1">
<Text color="subtle">storage</Text>
<Text color="subtle">download</Text>
<Text color="subtle">upload</Text>
<Text size="12" color="subtle">
storage
</Text>
<Text size="12" color="subtle">
download
</Text>
<Text size="12" color="subtle">
upload
</Text>
</div>
<div className="flex flex-col gap-1">
<Text color="contrast">
<Text size="12" color="contrast">
{humanBytes(host.settings?.total_storage || 0)}
</Text>
<Text color="contrast">{getDownloadSpeed(host)}</Text>
<Text color="contrast">{getUploadSpeed(host)}</Text>
<Text size="12" color="contrast">
{getDownloadSpeed(host)}
</Text>
<Text size="12" color="contrast">
{getUploadSpeed(host)}
</Text>
</div>
<div className="flex flex-col gap-1">
<Text color="contrast">{storageCost}</Text>
<Text color="contrast">{downloadCost}</Text>
<Text color="contrast">{uploadCost}</Text>
<Text size="12" color="contrast">
{storageCost}
</Text>
<Text size="12" color="contrast">
{downloadCost}
</Text>
<Text size="12" color="contrast">
{uploadCost}
</Text>
</div>
</div>
</div>
Expand Down
3 changes: 1 addition & 2 deletions apps/renterd/components/Keys/KeysCreateDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import {
FormSubmitButton,
ConfigFields,
useOnInvalid,
Paragraph,
Button,
} from '@siafoundation/design-system'
import { useCallback, useMemo } from 'react'
Expand Down Expand Up @@ -159,6 +158,7 @@ export function KeysCreateDialog({ trigger, open, onOpenChange }: Props) {
return (
<Dialog
title="Create S3 key"
description="Create a new S3 authentication key."
trigger={trigger}
open={open}
onOpenChange={(val) => {
Expand All @@ -178,7 +178,6 @@ export function KeysCreateDialog({ trigger, open, onOpenChange }: Props) {
}
>
<div className="flex flex-col gap-4">
<Paragraph>Create a new S3 authentication key.</Paragraph>
<div className="flex flex-col gap-2">
<FieldText name="name" form={form} fields={fields} />
<FieldText name="secret" form={form} fields={fields} />
Expand Down
16 changes: 8 additions & 8 deletions apps/renterd/contexts/contracts/columns.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -192,37 +192,37 @@ export const columns: ContractsTableColumn[] = [
content={
<div className="flex flex-col gap-1.5">
<div className="flex">
<Text className="flex-1" weight="medium">
<Text size="12" className="flex-1" weight="medium">
pending
</Text>
<Text className="flex-[2]" color="subtle">
<Text size="12" className="flex-[2]" color="subtle">
Contract has been added.
</Text>
</div>
<Separator className="w-full" />
<div className="flex">
<Text className="flex-1" weight="medium">
<Text size="12" className="flex-1" weight="medium">
active
</Text>
<Text className="flex-[2]" color="subtle">
<Text size="12" className="flex-[2]" color="subtle">
Contract has appeared on chain.
</Text>
</div>
<Separator className="w-full" />
<div className="flex">
<Text className="flex-1" weight="medium">
<Text size="12" className="flex-1" weight="medium">
complete
</Text>
<Text className="flex-[2]" color="subtle">
<Text size="12" className="flex-[2]" color="subtle">
Storage proof has appeared on chain.
</Text>
</div>
<Separator className="w-full" />
<div className="flex">
<Text className="flex-1" weight="medium">
<Text size="12" className="flex-1" weight="medium">
failed
</Text>
<Text className="flex-[2]" color="subtle">
<Text size="12" className="flex-[2]" color="subtle">
Storage proof was not submitted before the end of proof
window.
</Text>
Expand Down
9 changes: 7 additions & 2 deletions apps/renterd/contexts/uploads/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@ function useUploadsMain() {
const response = useMultipartUploadListUploads({
disabled: !activeBucket,
payload: payload as MultipartUploadListUploadsPayload,
config: {
swr: {
keepPreviousData: true,
},
},
})

const abortAll = useCallback(async () => {
Expand All @@ -64,9 +69,9 @@ function useUploadsMain() {
)
}, [response.data, apiBusUploadAbort, activeBucket, uploadsMap])

const dataset: ObjectUploadData[] | undefined = useMemo(() => {
const dataset: ObjectUploadData[] = useMemo(() => {
if (!response.data?.uploads || !activeBucket?.name) {
return undefined
return []
}
return response.data.uploads.map((upload) => {
const id = upload.uploadID
Expand Down
5 changes: 1 addition & 4 deletions apps/renterd/dialogs/FilesBucketCreateDialog.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import {
Paragraph,
Dialog,
triggerErrorToast,
triggerSuccessToast,
Expand Down Expand Up @@ -77,6 +76,7 @@ export function FilesBucketCreateDialog({
return (
<Dialog
title="Create Bucket"
description="A bucket is an isolated collection of files."
trigger={trigger}
open={open}
onOpenChange={(val) => {
Expand All @@ -91,9 +91,6 @@ export function FilesBucketCreateDialog({
onSubmit={form.handleSubmit(onSubmit, onInvalid)}
>
<div className="flex flex-col gap-4">
<Paragraph size="14">
A bucket is an isolated collection of files.
</Paragraph>
<FieldText name="name" form={form} fields={fields} autoComplete="off" />
<FormSubmitButton form={form}>Create bucket</FormSubmitButton>
</div>
Expand Down
1 change: 1 addition & 0 deletions apps/walletd/components/Wallet/WalletActionsMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export function WalletActionsMenu() {
const { openDialog } = useDialog()
const walletId = router.query.id as string
const balance = useWalletBalance({
disabled: !walletId,
params: {
id: walletId,
},
Expand Down
14 changes: 11 additions & 3 deletions apps/website/components/HostMap/Globe.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import { useTheme } from 'next-themes'
import { useElementSize } from 'usehooks-ts'

type Props = {
activeHost: SiaCentralPartialHost
activeHost?: SiaCentralPartialHost
selectActiveHost: (public_key: string) => void
hosts: SiaCentralPartialHost[]
rates: {
Expand Down Expand Up @@ -56,7 +56,9 @@ function GlobeComponent({ activeHost, hosts, rates, selectActiveHost }: Props) {
}, [])

const moveToActiveHost = useCallback(() => {
moveToHost(activeHost)
if (activeHost) {
moveToHost(activeHost)
}
}, [moveToHost, activeHost])

useEffect(() => {
Expand Down Expand Up @@ -110,6 +112,9 @@ function GlobeComponent({ activeHost, hosts, rates, selectActiveHost }: Props) {
}, [hosts])

const activeRoutes = useMemo(() => {
if (!activeHost) {
return []
}
let routes: Route[] = []
for (let i = 0; i < hosts.length; i++) {
const host = hosts[i]
Expand Down Expand Up @@ -212,8 +217,11 @@ function distanceBetweenHosts(

function doesIncludeActiveHost(
route: Route,
activeHost: SiaCentralPartialHost
activeHost?: SiaCentralPartialHost
) {
if (!activeHost) {
return false
}
return (
route.dst.public_key === activeHost.public_key ||
route.src.public_key === activeHost.public_key
Expand Down
Loading
Loading