Skip to content

Commit

Permalink
feat: renterd alert hints
Browse files Browse the repository at this point in the history
  • Loading branch information
alexfreska committed Oct 27, 2023
1 parent ea3d2f4 commit 000bbe5
Show file tree
Hide file tree
Showing 4 changed files with 70 additions and 31 deletions.
5 changes: 5 additions & 0 deletions .changeset/dull-plants-fail.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'renterd': minor
---

Alerts are now more concise and show an actionable hint when available.
43 changes: 42 additions & 1 deletion apps/renterd/dialogs/AlertsDialog.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
import {
Accordion,
AccordionContent,
AccordionItem,
AccordionTrigger,
AlertsDialog as DSAlertsDialog,
Link,
ScrollArea,
Expand Down Expand Up @@ -89,10 +93,12 @@ export function AlertsDialog({ open, onOpenChange }: Props) {
}

const dataFieldOrder = [
'hint',
'error',
'origin',
'hostKey',
'contractID',
'account',
'accountID',
'slabKey',
'additions',
'removals',
Expand Down Expand Up @@ -273,6 +279,41 @@ const dataFields: Record<
)
},
},
error: {
render: ({ value }: { value: string }) => (
<div className="flex flex-col w-full gap-2">
<Accordion type="single">
<AccordionItem value="error" variant="ghost">
<AccordionTrigger>
<Text color="subtle" ellipsis>
error
</Text>
</AccordionTrigger>
<AccordionContent>
<Text color="contrast">{value}</Text>
</AccordionContent>
</AccordionItem>
</Accordion>
</div>
),
},
hint: {
render: ({ value }: { value: string }) => (
<div className="flex flex-col w-full gap-2">
<Text color="contrast">{value}</Text>
</div>
),
},
allowance: {
render: ({ value }: { value: string }) => (
<div className="flex justify-between w-full gap-2">
<Text color="subtle" ellipsis>
allowance
</Text>
<ValueSc variant="value" value={new BigNumber(value)} />
</div>
),
},
balance: {
render: ({ value }: { value: string }) => (
<div className="flex justify-between w-full gap-2">
Expand Down
2 changes: 1 addition & 1 deletion apps/website/components/CalloutCoreSoftware.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export function CalloutCoreSoftware({
testnetOnly,
}: Props) {
return (
<PatternedPanel background={background} className="overflow-hidden">
<PatternedPanel background={background}>
<div className="flex flex-col gap-4 pt-8 pb-5 px-6">
<div className="flex gap-2 items-center">
<Heading size="40" font="mono" weight="semibold">
Expand Down
51 changes: 22 additions & 29 deletions apps/website/components/DownloadSelect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,34 +22,27 @@ export function DownloadSelect({ daemon, release, testnetOnly }: Props) {
const [download, setDownload] = useState(downloadLinks[0])

return (
<div
className="flex"
style={{
containerType: 'normal',
}}
>
<ControlGroup>
<Button state="waiting" className="hidden @sm:flex">
{release.tag_name}
</Button>
<Select
value={download.link}
onChange={(e) =>
setDownload(
downloadLinks.find((i) => i.link === e.currentTarget.value)
)
}
>
{downloadLinks.map((i) => (
<Option key={i.link} value={i.link}>
{testnetOnly ? `Testnet only: ${i.title}` : i.title}
</Option>
))}
</Select>
<LinkButton href={download.link} tip="Download binary" icon="contrast">
<Download16 />
</LinkButton>
</ControlGroup>
</div>
<ControlGroup>
<Button state="waiting" className="hidden @sm:flex">
{release.tag_name}
</Button>
<Select
value={download.link}
onChange={(e) =>
setDownload(
downloadLinks.find((i) => i.link === e.currentTarget.value)
)
}
>
{downloadLinks.map((i) => (
<Option key={i.link} value={i.link}>
{testnetOnly ? `Testnet only: ${i.title}` : i.title}
</Option>
))}
</Select>
<LinkButton href={download.link} tip="Download binary" icon="contrast">
<Download16 />
</LinkButton>
</ControlGroup>
)
}

0 comments on commit 000bbe5

Please sign in to comment.