Skip to content
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/wise-dodos-knock.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@arcanewizards/sigil': patch
---

Allow for UpdateBanner and UpdateDetails classes to be customized
4 changes: 2 additions & 2 deletions apps/timecode-toolbox/src/components/frontend/constants.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { TIMECODE_FPS } from '@arcanewizards/artnet/constants';
import {
UpdateCheckStrings,
UpdateBannerStrings,
UpdateDetailsStrings,
} from '@arcanewizards/sigil/frontend/updates';

Expand Down Expand Up @@ -174,7 +174,7 @@ export const STRINGS = {
`Version ${latest} is available! You are currently on version ${current}.`,
download: 'Download',
details: 'Details',
} satisfies UpdateCheckStrings,
} satisfies UpdateBannerStrings,
details: {
title: 'Update Details',
close: 'Close',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ export const Layout = <WindowMode extends string>({
strings={STRINGS.updates.banner}
updates={updates}
openDetails={viewUpdateDetails}
className="border-b"
/>
<div className="relative flex h-0 grow flex-col">
{connection.state !== 'connected' ? (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -504,6 +504,7 @@ export const ToolboxRoot: FC<Props> = ({ info }) => {
updates={info.state.updates}
strings={STRINGS.updates.details}
closeDetails={() => setWindowMode(null)}
className="grow"
/>
) : null,
button: null,
Expand Down
37 changes: 24 additions & 13 deletions packages/sigil/src/frontend/updates.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ import type { CheckForUpdatesResponse } from '@arcanewizards/apis';
import { ToolbarDivider, ToolbarRow, ToolbarWrapper } from './toolbars';
import { ControlButton } from './controls';
import { apiContentToReact } from './utils';
import { cn } from '@arcanejs/toolkit-frontend/util';

export type UpdateCheckStrings = {
export type UpdateBannerStrings = {
download: string;
details: string;
updateAvailable: (currentVersion: string, latestVersion: string) => string;
Expand All @@ -33,7 +34,8 @@ export type UpdateCheckResult =
};

type UpdateBannerProps = {
strings: UpdateCheckStrings;
className?: string;
strings: UpdateBannerStrings;
updates: UpdateCheckResult | null;
openDetails?: () => void;
};
Expand All @@ -47,6 +49,7 @@ const clsBannerButton = () => `
`;

export const UpdateBanner: FC<UpdateBannerProps> = ({
className,
strings,
updates,
openDetails,
Expand Down Expand Up @@ -82,11 +85,14 @@ export const UpdateBanner: FC<UpdateBannerProps> = ({
if (displayState?.type === 'error') {
return (
<div
className="
flex items-center justify-center gap-2 border-b
border-sigil-usage-orange-border bg-sigil-usage-orange-background p-1
text-sigil-usage-orange-text
"
className={cn(
`
flex items-center justify-center gap-2
border-sigil-usage-orange-border bg-sigil-usage-orange-background
p-1 text-sigil-usage-orange-text
`,
className,
)}
>
<Icon icon="error" />
{displayState.error}
Expand All @@ -97,11 +103,14 @@ export const UpdateBanner: FC<UpdateBannerProps> = ({
if (displayState?.type === 'updates-available') {
return (
<div
className="
flex items-center justify-center gap-2 border-b
border-sigil-usage-hint-border bg-sigil-usage-hint-background p-1
text-sigil-usage-hint-text
"
className={cn(
`
flex items-center justify-center gap-2
border-sigil-usage-hint-border bg-sigil-usage-hint-background p-1
text-sigil-usage-hint-text
`,
className,
)}
>
<Icon icon="upgrade" />
{strings.updateAvailable(version, displayState.response.latestVersion)}
Expand Down Expand Up @@ -130,12 +139,14 @@ export type UpdateDetailsStrings = {
};

type UpdateDetailsProps = {
className?: string;
updates: UpdateCheckResult;
strings: UpdateDetailsStrings;
closeDetails: () => void;
};

export const UpdateDetails: FC<UpdateDetailsProps> = ({
className,
updates,
strings,
closeDetails,
Expand All @@ -147,7 +158,7 @@ export const UpdateDetails: FC<UpdateDetailsProps> = ({
}

return (
<div className="flex grow flex-col">
<div className={cn('flex flex-col', className)}>
<ToolbarWrapper>
<ToolbarRow>
<span className="grow p-1">{strings.title}</span>
Expand Down