Skip to content

Commit

Permalink
Tweak update notifications (#986)
Browse files Browse the repository at this point in the history
  • Loading branch information
sceuick authored Jul 30, 2024
1 parent 37dd2bb commit 00d08b4
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
1 change: 1 addition & 0 deletions web/Toasts.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,7 @@ const Update: Component<{ announcement: AppSchema.Announcement; seen?: boolean }
</div>
}
type={props.seen ? 'bg' : 'hl'}
bg={props.seen ? 'bg-700' : undefined}
contentClass="bg-800"
>
<div class="markdown" innerHTML={markup()}></div>
Expand Down
7 changes: 6 additions & 1 deletion web/shared/Card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ export const TitleCard: Component<{
ariaRole?: JSX.AriaAttributes['role']
ariaLabel?: string
contentClass?: string
bg?: string
}> = (props) => {
const cfg = userStore((s) => s.ui)

Expand All @@ -134,8 +135,12 @@ export const TitleCard: Component<{
const base = type === 'bg' || cfg.mode === 'dark' || type === 'hl' ? 800 : 100
const mod = type === 'bg' || cfg.mode === 'dark' || type === 'hl' ? -200 : 200

const bgColor = props.bg
? (getRgbaFromVar(props.bg, 1)?.background as string)
: `var(--${type}-${base})`

return {
'background-color': `var(--${type}-${base})`,
'background-color': bgColor,
border: `1px solid var(--${type}-${base + mod})`,
'border-radius': '0.375rem',
}
Expand Down
6 changes: 6 additions & 0 deletions web/store/announce.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,4 +84,10 @@ subscribe('announcement', { announcement: 'any' }, (body) => {

const next = list.concat(body.announcement)
announceStore.setState({ list: next })

if (body.announcement.location === 'notification') {
toastStore.info(`New announcement! Check your notifications.`)
} else {
toastStore.info(`New announcement! Check the home page.`)
}
})

0 comments on commit 00d08b4

Please sign in to comment.