@justanarthur/modo-ui-notch 0.0.0-stage → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +75 -2
- package/blocks/activities/agenda/examples.mdx +74 -0
- package/blocks/activities/agenda/index.tsx +441 -0
- package/blocks/activities/clock/examples.mdx +73 -0
- package/blocks/activities/clock/index.tsx +619 -0
- package/blocks/activities/now-playing/examples.mdx +68 -0
- package/blocks/activities/now-playing/index.tsx +411 -0
- package/blocks/activities/weather/examples.mdx +115 -0
- package/blocks/activities/weather/index.tsx +634 -0
- package/blocks/app/expanded-island/examples.mdx +46 -0
- package/blocks/app/expanded-island/index.tsx +143 -0
- package/blocks/app/settings-window/examples.mdx +34 -0
- package/blocks/app/settings-window/index.tsx +375 -0
- package/blocks/system/clipboard/examples.mdx +83 -0
- package/blocks/system/clipboard/index.tsx +563 -0
- package/blocks/system/recent-files/examples.mdx +66 -0
- package/blocks/system/recent-files/index.tsx +542 -0
- package/blocks/system/system-stats/examples.mdx +52 -0
- package/blocks/system/system-stats/index.tsx +312 -0
- package/components/indicators/countdown/examples.mdx +25 -0
- package/components/indicators/countdown/index.tsx +83 -0
- package/components/indicators/equalizer/examples.mdx +20 -0
- package/components/indicators/equalizer/index.tsx +116 -0
- package/components/indicators/media-scrubber/examples.mdx +29 -0
- package/components/indicators/media-scrubber/index.tsx +122 -0
- package/components/island/island/examples.mdx +57 -0
- package/components/island/island/index.tsx +415 -0
- package/components/island/island-flash/examples.mdx +52 -0
- package/components/island/island-flash/index.tsx +79 -0
- package/components/island/island-tabs/examples.mdx +53 -0
- package/components/island/island-tabs/index.tsx +285 -0
- package/components/island/widget/examples.mdx +76 -0
- package/components/island/widget/index.tsx +431 -0
- package/dist/blocks/activities/agenda/index.d.ts +2 -0
- package/dist/blocks/activities/agenda/index.js +21 -0
- package/dist/blocks/activities/clock/index.d.ts +2 -0
- package/dist/blocks/activities/clock/index.js +25 -0
- package/dist/blocks/activities/now-playing/index.d.ts +3 -0
- package/dist/blocks/activities/now-playing/index.js +24 -0
- package/dist/blocks/activities/weather/index.d.ts +2 -0
- package/dist/blocks/activities/weather/index.js +21 -0
- package/dist/blocks/app/expanded-island/index.d.ts +3 -0
- package/dist/blocks/app/expanded-island/index.js +11 -0
- package/dist/blocks/app/settings-window/index.d.ts +2 -0
- package/dist/blocks/app/settings-window/index.js +7 -0
- package/dist/blocks/system/clipboard/index.d.ts +2 -0
- package/dist/blocks/system/clipboard/index.js +17 -0
- package/dist/blocks/system/recent-files/index.d.ts +2 -0
- package/dist/blocks/system/recent-files/index.js +19 -0
- package/dist/blocks/system/system-stats/index.d.ts +2 -0
- package/dist/blocks/system/system-stats/index.js +15 -0
- package/dist/components/indicators/countdown/index.d.ts +2 -0
- package/dist/components/indicators/countdown/index.js +8 -0
- package/dist/components/indicators/equalizer/index.d.ts +2 -0
- package/dist/components/indicators/equalizer/index.js +7 -0
- package/dist/components/indicators/media-scrubber/index.d.ts +2 -0
- package/dist/components/indicators/media-scrubber/index.js +8 -0
- package/dist/components/island/island/index.d.ts +3 -0
- package/dist/components/island/island/index.js +10 -0
- package/dist/components/island/island-flash/index.d.ts +2 -0
- package/dist/components/island/island-flash/index.js +7 -0
- package/dist/components/island/island-tabs/index.d.ts +2 -0
- package/dist/components/island/island-tabs/index.js +9 -0
- package/dist/components/island/widget/index.d.ts +2 -0
- package/dist/components/island/widget/index.js +30 -0
- package/dist/index.d.ts +21 -0
- package/dist/index.js +195 -0
- package/dist/lib/artwork.d.ts +2 -0
- package/dist/lib/artwork.js +8 -0
- package/dist/lib/clock.d.ts +2 -0
- package/dist/lib/clock.js +14 -0
- package/dist/lib/geometry.d.ts +2 -0
- package/dist/lib/geometry.js +24 -0
- package/dist/lib/island-context.d.ts +3 -0
- package/dist/lib/island-context.js +8 -0
- package/dist/lib/motion.d.ts +21 -0
- package/dist/lib/motion.js +16 -0
- package/dist/shared/chunk-152gpyq3.d.ts +13 -0
- package/dist/shared/chunk-2818esrq.d.ts +140 -0
- package/dist/shared/chunk-2f7zxrbk.js +65 -0
- package/dist/shared/chunk-2m5dz8nf.d.ts +88 -0
- package/dist/shared/chunk-2s4q6mt0.js +27 -0
- package/dist/shared/chunk-3thgcfcq.d.ts +151 -0
- package/dist/shared/chunk-416tsgbc.d.ts +175 -0
- package/dist/shared/chunk-502rmtap.js +54 -0
- package/dist/shared/chunk-52gb3g6r.d.ts +12 -0
- package/dist/shared/chunk-5en5aaj1.d.ts +33 -0
- package/dist/shared/chunk-61t2dfte.js +63 -0
- package/dist/shared/chunk-7fvnrtz4.d.ts +105 -0
- package/dist/shared/chunk-81fpptwp.d.ts +75 -0
- package/dist/shared/chunk-9c7ewvkk.js +381 -0
- package/dist/shared/chunk-9m0xbg5v.js +112 -0
- package/dist/shared/chunk-9xtcv3sy.js +88 -0
- package/dist/shared/chunk-bvtyjcce.d.ts +123 -0
- package/dist/shared/chunk-cc9nwbtf.js +315 -0
- package/dist/shared/chunk-cfzmfnyh.d.ts +63 -0
- package/dist/shared/chunk-d5qm9cps.js +10 -0
- package/dist/shared/chunk-da177e8r.d.ts +114 -0
- package/dist/shared/chunk-fexwzycv.d.ts +36 -0
- package/dist/shared/chunk-gb56m10p.js +39 -0
- package/dist/shared/chunk-gejenfap.d.ts +25 -0
- package/dist/shared/chunk-hrpxbqmx.d.ts +28 -0
- package/dist/shared/chunk-j755a1a5.d.ts +41 -0
- package/dist/shared/chunk-j77cx8dp.js +498 -0
- package/dist/shared/chunk-mt0k6v8x.js +474 -0
- package/dist/shared/chunk-ndf79pv5.js +58 -0
- package/dist/shared/chunk-pfhy5e4q.d.ts +53 -0
- package/dist/shared/chunk-qdzemt2v.js +477 -0
- package/dist/shared/chunk-r471sknr.js +209 -0
- package/dist/shared/chunk-s2jeqqan.js +243 -0
- package/dist/shared/chunk-t0hcxh89.d.ts +124 -0
- package/dist/shared/chunk-w48eyvfr.d.ts +56 -0
- package/dist/shared/chunk-w5h6ay93.js +72 -0
- package/dist/shared/chunk-wkg17nxs.d.ts +101 -0
- package/dist/shared/chunk-x7f3g82r.js +285 -0
- package/dist/shared/chunk-xq5hc5gv.js +333 -0
- package/dist/shared/chunk-y0188bbn.js +331 -0
- package/dist/shared/chunk-ym0xbses.js +518 -0
- package/dist/styles.css +264 -0
- package/index.ts +22 -0
- package/lib/artwork.ts +112 -0
- package/lib/clock.ts +53 -0
- package/lib/geometry.ts +130 -0
- package/lib/island-context.tsx +24 -0
- package/lib/motion.ts +42 -0
- package/mock/activities.tsx +77 -0
- package/mock/artwork.tsx +37 -0
- package/mock/clipboard.tsx +79 -0
- package/mock/clock.tsx +77 -0
- package/mock/data.ts +139 -0
- package/mock/desktop.tsx +83 -0
- package/mock/files.tsx +70 -0
- package/mock/fit.ts +26 -0
- package/mock/island-content.tsx +142 -0
- package/mock/scene.tsx +52 -0
- package/mock/screen.tsx +76 -0
- package/mock/settings.tsx +489 -0
- package/mock/system.ts +46 -0
- package/mock/weather.tsx +105 -0
- package/package.json +122 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 justAnArthur
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,76 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @justanarthur/modo-ui-notch
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
The UI of a macOS notch app on [modo-ui](https://www.npmjs.com/package/@justanarthur/modo-ui): the island
|
|
4
|
+
that grows out of the notch (idle, compact, split, expanded, flash), its icon tabs across the wings around
|
|
5
|
+
the notch, and the pieces its activities show. Presentational: every component takes its data and
|
|
6
|
+
callbacks as props, so it fits any host (a Tauri or Electron panel, a web mock-up).
|
|
7
|
+
|
|
8
|
+
Docs and live examples: https://justanarthur.github.io/modo/notch/
|
|
9
|
+
|
|
10
|
+
## Install
|
|
11
|
+
|
|
12
|
+
```sh
|
|
13
|
+
npm install @justanarthur/modo-ui-notch @justanarthur/modo-ui react react-dom
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
`@justanarthur/modo-ui`, `react` and `react-dom` are peers: the kit uses your copy of modo-ui, so its
|
|
17
|
+
contexts (size, shape, surface) are the ones your app provides.
|
|
18
|
+
|
|
19
|
+
## Styles
|
|
20
|
+
|
|
21
|
+
Load modo-ui's stylesheet, then the kit's utilities:
|
|
22
|
+
|
|
23
|
+
```ts
|
|
24
|
+
import '@justanarthur/modo-ui/styles.css'
|
|
25
|
+
import '@justanarthur/modo-ui-notch/styles.css'
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
On UnoCSS or Tailwind, scan the kit's `dist/` with modo-ui's preset instead (see modo-ui's README).
|
|
29
|
+
|
|
30
|
+
## Usage
|
|
31
|
+
|
|
32
|
+
```tsx
|
|
33
|
+
import { Equalizer, Island, IslandFlash, IslandTabs } from '@justanarthur/modo-ui-notch'
|
|
34
|
+
|
|
35
|
+
export function NotchPanel({ state, onStateChange }) {
|
|
36
|
+
return (
|
|
37
|
+
<Island
|
|
38
|
+
state={state}
|
|
39
|
+
onStateChange={onStateChange}
|
|
40
|
+
expandOnHover
|
|
41
|
+
leading={<Artwork />}
|
|
42
|
+
trailing={<Equalizer playing />}
|
|
43
|
+
flash={<IslandFlash title="Focus done" caption="A short break next" value="5 min" tone="success" />}
|
|
44
|
+
expanded={<Panel />}
|
|
45
|
+
/>
|
|
46
|
+
)
|
|
47
|
+
}
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
| Export | What it is |
|
|
51
|
+
|---|---|
|
|
52
|
+
| `Island` | The black outline hanging from the top edge, its five states, the compact wings, the split bubble that melts off through modo-ui's goo, the content swap. `state` / `defaultState` / `onStateChange`; geometry from `notchWidth`, `notchHeight`, `panelWidth`, `panelHeight`. |
|
|
53
|
+
| `IslandTabs` | Icon tabs in both wings around the notch, modo-ui's liquid indicator crossing the gap; overflow scrolls behind the notch. `value` / `defaultValue` / `onValueChange`, `onHoverChange` for a title preview. |
|
|
54
|
+
| `IslandFlash` | The transient alert's layout: icon, title, caption, value, trailing glyph, action. |
|
|
55
|
+
| `Widget` | The frame every open-island widget is built in (picture, main column, aside past a hairline) and its parts: `.Header`, `.Title`, `.Subtitle`, `.Figure`, `.Meta` / `.MetaItem`, `.Action`, `.Section`, `.Row`, `.Chip`, `.Message`. |
|
|
56
|
+
| `Equalizer` | Now-playing level bars on a compositor-only Web Animations loop. |
|
|
57
|
+
| `MediaScrubber` | Elapsed / scrubber / remaining on modo-ui's Slider; seeks once on commit; `quiet` is a thin line until hovered. |
|
|
58
|
+
| `Countdown` | Time left as `4:05` or `4m`, re-rendering only on the shown unit's edge. |
|
|
59
|
+
| `NowPlaying` | The player for the open island (artwork that never blinks, tinted glow, scrubber, transport, source and output, shuffle / repeat / like), with `.Leading` / `.Trailing` (compact wings), `.Minimal` (split bubble), `.Flash` (track change) and `.Artwork`. |
|
|
60
|
+
| `Agenda` | The next event as the hero (countdown, Join), the rest of today and tomorrow beside it, access states; `.Leading`, `.Trailing`, `.Minimal`, `.UpNext`, `.Starting` (the countdown to the next event). |
|
|
61
|
+
| `Weather` | The temperature now as the hero, the next hours and tomorrow beside it, °C / °F, loading, offline, error and location-access states; `.Leading`, `.Trailing`, `.Minimal`, `.Alert` (rain soon, a warning); `conditionFromCode` reads a WMO code. |
|
|
62
|
+
| `Clock` | The time, the date and world clocks, and a Pomodoro cycle that takes the widget over while it runs (pause, skip, +1 min, reset); `.Leading`, `.Trailing`, `.Minimal`, `.PhaseDone` (focus done, break over); `startPomodoro`, `advancePomodoro`, `resumePomodoro`. |
|
|
63
|
+
| `SystemStats` | The CPU load (or memory pressure) as the hero with its trend, battery, disk and uptime under it, the busiest processes beside it; `.Leading`, `.Trailing`, `.Minimal`. |
|
|
64
|
+
| `ClipboardHistory` | The latest clip as the hero (text, link, image, color, file), the searchable history beside it with pins, pause and ignored apps; `.Leading`, `.Trailing`, `.Copied`. |
|
|
65
|
+
| `RecentFiles` | The newest download or screenshot as the hero, ready to open, reveal, copy or drag out, the ones before it beside it, a download under way; `.Leading`, `.Trailing`, `.Minimal`, `.Saved`. |
|
|
66
|
+
| `ExpandedIsland` | The open island's layout: tabs in the wings, the tab's title, a fixed-height scrolling view. |
|
|
67
|
+
| `SettingsWindow` | The app's settings: General, Plugins, Permissions, About and each plugin's page. |
|
|
68
|
+
| `useStableArtwork`, `useArtworkTint` | Artwork held across updates and the tint read from an image (`@justanarthur/modo-ui-notch/lib/artwork`). |
|
|
69
|
+
| `useIsland()` | The enclosing Island's state, notch and panel geometry and current outline. |
|
|
70
|
+
| `shapeFor`, `islandPath`, `stripLayout`, … | The pure geometry (`@justanarthur/modo-ui-notch/lib/geometry`). |
|
|
71
|
+
|
|
72
|
+
Each component and block is also a subpath: `@justanarthur/modo-ui-notch/components/island/island`, `@justanarthur/modo-ui-notch/blocks/activities/now-playing`.
|
|
73
|
+
|
|
74
|
+
## License
|
|
75
|
+
|
|
76
|
+
MIT © 2026 justAnArthur
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import Agenda from './index'
|
|
2
|
+
import { WidgetIsland } from '../../../mock/island-content'
|
|
3
|
+
import { AgendaFlash, AgendaSplit, AgendaWings, UpNextIsland } from '../../../mock/activities'
|
|
4
|
+
import { AGENDA_NOW, EVENTS } from '../../../mock/data'
|
|
5
|
+
|
|
6
|
+
# Today and tomorrow
|
|
7
|
+
|
|
8
|
+
The next event as the hero, how soon set large, with Join for a call; the rest of today beside it, tomorrow folded to its first event, today's all-day events as chips on the date line.
|
|
9
|
+
|
|
10
|
+
<WidgetIsland tab="calendar">
|
|
11
|
+
<Agenda events={EVENTS} now={AGENDA_NOW} />
|
|
12
|
+
</WidgetIsland>
|
|
13
|
+
|
|
14
|
+
# In progress
|
|
15
|
+
|
|
16
|
+
While an event runs the hero says `Now` and how long is left.
|
|
17
|
+
|
|
18
|
+
<WidgetIsland tab="calendar">
|
|
19
|
+
<Agenda events={EVENTS} now={AGENDA_NOW + 65 * 60_000} defaultTomorrowOpen />
|
|
20
|
+
</WidgetIsland>
|
|
21
|
+
|
|
22
|
+
# Later today
|
|
23
|
+
|
|
24
|
+
More than an hour out, the hero is the start time.
|
|
25
|
+
|
|
26
|
+
<WidgetIsland tab="calendar">
|
|
27
|
+
<Agenda events={EVENTS} now={AGENDA_NOW + 5 * 60 * 60_000} />
|
|
28
|
+
</WidgetIsland>
|
|
29
|
+
|
|
30
|
+
# Nothing planned
|
|
31
|
+
|
|
32
|
+
<WidgetIsland tab="calendar">
|
|
33
|
+
<Agenda events={[]} />
|
|
34
|
+
</WidgetIsland>
|
|
35
|
+
|
|
36
|
+
# Asking for access
|
|
37
|
+
|
|
38
|
+
`access="undetermined"` asks to connect the calendar.
|
|
39
|
+
|
|
40
|
+
<WidgetIsland tab="calendar">
|
|
41
|
+
<Agenda events={[]} access="undetermined" />
|
|
42
|
+
</WidgetIsland>
|
|
43
|
+
|
|
44
|
+
# Access off
|
|
45
|
+
|
|
46
|
+
`access="denied"` says where to turn it on.
|
|
47
|
+
|
|
48
|
+
<WidgetIsland tab="calendar">
|
|
49
|
+
<Agenda events={[]} access="denied" />
|
|
50
|
+
</WidgetIsland>
|
|
51
|
+
|
|
52
|
+
# Compact
|
|
53
|
+
|
|
54
|
+
The next event a few minutes out: `Agenda.Leading` and `Agenda.Trailing` count down in the wings.
|
|
55
|
+
|
|
56
|
+
<AgendaWings />
|
|
57
|
+
|
|
58
|
+
# Minimal
|
|
59
|
+
|
|
60
|
+
`Agenda.Minimal`, a ring in the event's color, empties toward the start in the split island's bubble.
|
|
61
|
+
|
|
62
|
+
<AgendaSplit />
|
|
63
|
+
|
|
64
|
+
# Up next, open
|
|
65
|
+
|
|
66
|
+
`Agenda.UpNext`, the hero on its own in the open island.
|
|
67
|
+
|
|
68
|
+
<UpNextIsland />
|
|
69
|
+
|
|
70
|
+
# Starting
|
|
71
|
+
|
|
72
|
+
`Agenda.Starting`, the flash a minute before.
|
|
73
|
+
|
|
74
|
+
<AgendaFlash />
|
|
@@ -0,0 +1,441 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Local addition: a notch app's calendar, the next event and the rest of
|
|
3
|
+
* today and tomorrow, with the countdown to the next one. Rebuilt from Just
|
|
4
|
+
* Notch's calendar plugin (`Agenda`, `Upcoming`, `Starting`, `Ring`,
|
|
5
|
+
* `Countdown`) as presentational parts: events, access and actions come in
|
|
6
|
+
* as props.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
'use client'
|
|
10
|
+
|
|
11
|
+
import Button from '@justanarthur/modo-ui/components/actions/button'
|
|
12
|
+
import type { SizeVariant } from '@justanarthur/modo-ui/lib/size-context'
|
|
13
|
+
import { useControllableState } from '@justanarthur/modo-ui/lib/use-controllable-state'
|
|
14
|
+
import { cn } from '@justanarthur/modo-ui/lib/utils'
|
|
15
|
+
import { CalendarCheck, CalendarDays, ChevronDown, ChevronUp, Clock, Lock, MapPin, Video } from 'lucide-react'
|
|
16
|
+
import IslandFlash from '../../../components/island/island-flash'
|
|
17
|
+
import Widget from '../../../components/island/widget'
|
|
18
|
+
import { formatShort, MINUTE, SECOND, useEdgeClock } from '../../../lib/clock'
|
|
19
|
+
|
|
20
|
+
type AgendaAccess = 'granted' | 'undetermined' | 'denied'
|
|
21
|
+
|
|
22
|
+
interface AgendaEvent {
|
|
23
|
+
id: string
|
|
24
|
+
title: string
|
|
25
|
+
/** When it starts, in epoch ms. */
|
|
26
|
+
start: number
|
|
27
|
+
/** When it ends, in epoch ms. */
|
|
28
|
+
end: number
|
|
29
|
+
allDay?: boolean
|
|
30
|
+
location?: string
|
|
31
|
+
/** A video call's link: the event gets a Join button. */
|
|
32
|
+
meetingUrl?: string
|
|
33
|
+
/** Its calendar's color, any CSS color: data, so it paints the dot, the mark and the ring inline. */
|
|
34
|
+
color: string
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
interface AgendaProps {
|
|
38
|
+
/** The events, in any order. */
|
|
39
|
+
events: AgendaEvent[]
|
|
40
|
+
/** Whether the calendar may be read: undetermined asks, denied points to the system's settings. Defaults to `'granted'`. */
|
|
41
|
+
access?: AgendaAccess
|
|
42
|
+
/** The moment the agenda is read at, in epoch ms. Defaults to now, re-read on each minute. */
|
|
43
|
+
now?: number
|
|
44
|
+
/** Formats the times and the date. Defaults to the browser's locale. */
|
|
45
|
+
locale?: Intl.LocalesArgument
|
|
46
|
+
/** Tomorrow's events are unfolded (controlled); folded, only its first shows. */
|
|
47
|
+
tomorrowOpen?: boolean
|
|
48
|
+
/** Tomorrow's events are unfolded at first (uncontrolled). Defaults to `false`. */
|
|
49
|
+
defaultTomorrowOpen?: boolean
|
|
50
|
+
/** Called with the new state when tomorrow's fold is pressed. */
|
|
51
|
+
onTomorrowOpenChange?: (open: boolean) => void
|
|
52
|
+
/** Called by Connect calendar while access is undetermined. */
|
|
53
|
+
onRequestAccess?: () => void
|
|
54
|
+
/** Called by Open System Settings while access is denied. */
|
|
55
|
+
onOpenSettings?: () => void
|
|
56
|
+
/** Called by the next event's Join button. */
|
|
57
|
+
onJoin?: (event: AgendaEvent) => void
|
|
58
|
+
/** Classes for the root, which fills its container. */
|
|
59
|
+
className?: string
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/** Rows the timeline lists per day before it says how many more. */
|
|
63
|
+
const ROWS = 3
|
|
64
|
+
|
|
65
|
+
const time = (ms: number, locale?: Intl.LocalesArgument) =>
|
|
66
|
+
new Date(ms).toLocaleTimeString(locale, { hour: 'numeric', minute: '2-digit' })
|
|
67
|
+
|
|
68
|
+
/** A time split into its figure and its day period: `4:00` and `PM`, or `16:00` alone. */
|
|
69
|
+
function timeParts(ms: number, locale?: Intl.LocalesArgument) {
|
|
70
|
+
const parts = new Intl.DateTimeFormat(locale, { hour: 'numeric', minute: '2-digit' }).formatToParts(ms)
|
|
71
|
+
const period = parts.find(part => part.type === 'dayPeriod')?.value
|
|
72
|
+
const value = parts
|
|
73
|
+
.filter(part => part.type !== 'dayPeriod')
|
|
74
|
+
.map(part => part.value)
|
|
75
|
+
.join('')
|
|
76
|
+
.trim()
|
|
77
|
+
return { value, period }
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
const range = (event: AgendaEvent, locale?: Intl.LocalesArgument) =>
|
|
81
|
+
`${time(event.start, locale)} – ${time(event.end, locale)}`
|
|
82
|
+
|
|
83
|
+
function length(ms: number) {
|
|
84
|
+
const minutes = Math.round(ms / MINUTE)
|
|
85
|
+
if (minutes < 60) return `${minutes} min`
|
|
86
|
+
const hours = Math.floor(minutes / 60)
|
|
87
|
+
return minutes % 60 ? `${hours} h ${minutes % 60} min` : `${hours} h`
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/** The time until `start`, re-read on each `unit` edge before it, never in between. */
|
|
91
|
+
function useUntil(start: number, unit = MINUTE) {
|
|
92
|
+
const now = useEdgeClock(start, Date.now() < start + SECOND, unit)
|
|
93
|
+
return start - now
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
function Dot({ color, className }: { color: string; className?: string }) {
|
|
97
|
+
return (
|
|
98
|
+
<span aria-hidden className={cn('size-2.5 shrink-0 rounded-full', className)} style={{ backgroundColor: color }} />
|
|
99
|
+
)
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
function Join({
|
|
103
|
+
event,
|
|
104
|
+
size,
|
|
105
|
+
onJoin,
|
|
106
|
+
}: {
|
|
107
|
+
event: AgendaEvent
|
|
108
|
+
size?: SizeVariant
|
|
109
|
+
onJoin?: (event: AgendaEvent) => void
|
|
110
|
+
}) {
|
|
111
|
+
return (
|
|
112
|
+
<Button variant="primary" size={size} leadingIcon={Video} onClick={() => onJoin?.(event)}>
|
|
113
|
+
Join
|
|
114
|
+
</Button>
|
|
115
|
+
)
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
interface HeroProps {
|
|
119
|
+
event: AgendaEvent
|
|
120
|
+
now: number
|
|
121
|
+
midnight: number
|
|
122
|
+
locale?: Intl.LocalesArgument
|
|
123
|
+
onJoin?: (event: AgendaEvent) => void
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
/** How soon, as the figure: `in 12 min` within the hour, `Now` while on, else the start time. */
|
|
127
|
+
function When({ event, now, midnight, locale }: Omit<HeroProps, 'onJoin'>) {
|
|
128
|
+
if (event.start <= now) return <Widget.Figure value="Now" unit={`${length(event.end - now)} left`} />
|
|
129
|
+
if (event.start - now < 60 * MINUTE)
|
|
130
|
+
return <Widget.Figure prefix="in" value={Math.max(1, Math.ceil((event.start - now) / MINUTE))} unit="min" />
|
|
131
|
+
const { value, period } = timeParts(event.start, locale)
|
|
132
|
+
return <Widget.Figure prefix={event.start >= midnight ? 'Tomorrow' : 'at'} value={value} unit={period} />
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
/** The next event, set as the widget's hero: how soon, its title in its calendar's color, when and where, and Join. */
|
|
136
|
+
function Hero({ event, now, midnight, locale, onJoin }: HeroProps) {
|
|
137
|
+
return (
|
|
138
|
+
<div className="flex min-w-0 flex-col gap-1.5">
|
|
139
|
+
<div className="flex min-w-0 items-end justify-between gap-3">
|
|
140
|
+
<When event={event} now={now} midnight={midnight} locale={locale} />
|
|
141
|
+
{event.meetingUrl && <Join event={event} size="compact" onJoin={onJoin} />}
|
|
142
|
+
</div>
|
|
143
|
+
<div className="flex min-w-0 flex-col gap-0.5">
|
|
144
|
+
<Widget.Title leading={<Dot color={event.color} />}>{event.title}</Widget.Title>
|
|
145
|
+
<Widget.Meta className="pl-4.5">
|
|
146
|
+
<Widget.MetaItem icon={Clock}>{range(event, locale)}</Widget.MetaItem>
|
|
147
|
+
{event.meetingUrl && <Widget.MetaItem icon={Video}>Video call</Widget.MetaItem>}
|
|
148
|
+
{event.location && <Widget.MetaItem icon={MapPin}>{event.location}</Widget.MetaItem>}
|
|
149
|
+
</Widget.Meta>
|
|
150
|
+
</div>
|
|
151
|
+
</div>
|
|
152
|
+
)
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
function Rows({ events, locale }: { events: AgendaEvent[]; locale?: Intl.LocalesArgument }) {
|
|
156
|
+
return events.map(event => (
|
|
157
|
+
<Widget.Row
|
|
158
|
+
key={event.id}
|
|
159
|
+
leading={time(event.start, locale)}
|
|
160
|
+
color={event.color}
|
|
161
|
+
trailing={
|
|
162
|
+
event.meetingUrl ? (
|
|
163
|
+
<Video size={12} strokeWidth={1.5} aria-label="Video call" />
|
|
164
|
+
) : (
|
|
165
|
+
event.location && <span className="max-w-24 truncate">{event.location}</span>
|
|
166
|
+
)
|
|
167
|
+
}
|
|
168
|
+
>
|
|
169
|
+
{event.title}
|
|
170
|
+
</Widget.Row>
|
|
171
|
+
))
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
function More({ count }: { count: number }) {
|
|
175
|
+
if (count <= 0) return null
|
|
176
|
+
return <span className="flex h-6 items-center pl-17.5 text-caption text-muted-foreground">{count} more</span>
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
interface PartProps {
|
|
180
|
+
/** The event the activity counts down to. */
|
|
181
|
+
event: AgendaEvent
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
/** The compact island's left wing: the calendar glyph in the event's color. */
|
|
185
|
+
function AgendaLeading({ event }: PartProps) {
|
|
186
|
+
return <CalendarDays size={16} strokeWidth={1.5} style={{ color: event.color }} />
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
/** The compact island's right wing: the event's color dot and the time until it starts, `12m` then `45s`. */
|
|
190
|
+
function AgendaTrailing({ event }: PartProps) {
|
|
191
|
+
const left = useUntil(event.start)
|
|
192
|
+
return (
|
|
193
|
+
<span className="flex items-center gap-1 text-caption weight-semibold text-foreground tabular-nums">
|
|
194
|
+
<Dot color={event.color} className="size-1.5" />
|
|
195
|
+
{left > 0 ? formatShort(left / SECOND) : 'now'}
|
|
196
|
+
</span>
|
|
197
|
+
)
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
interface MinimalProps extends PartProps {
|
|
201
|
+
/** How long before the start the countdown opens, in ms: the full ring. Defaults to 10 minutes. */
|
|
202
|
+
lead?: number
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
const RING = 2 * Math.PI * 8
|
|
206
|
+
|
|
207
|
+
/** The split island's bubble: a ring in the event's color that empties as the start nears. */
|
|
208
|
+
function AgendaMinimal({ event, lead = 10 * MINUTE }: MinimalProps) {
|
|
209
|
+
const left = Math.max(0, useUntil(event.start, SECOND))
|
|
210
|
+
const share = Math.min(1, left / lead)
|
|
211
|
+
return (
|
|
212
|
+
<svg
|
|
213
|
+
role="img"
|
|
214
|
+
aria-label={`${event.title}, in ${formatShort(left / SECOND)}`}
|
|
215
|
+
viewBox="0 0 20 20"
|
|
216
|
+
className="size-5.5 -rotate-90"
|
|
217
|
+
>
|
|
218
|
+
<circle cx="10" cy="10" r="8" fill="none" strokeWidth="2.5" className="stroke-current text-border" />
|
|
219
|
+
<circle
|
|
220
|
+
cx="10"
|
|
221
|
+
cy="10"
|
|
222
|
+
r="8"
|
|
223
|
+
fill="none"
|
|
224
|
+
strokeWidth="2.5"
|
|
225
|
+
strokeLinecap="round"
|
|
226
|
+
strokeDasharray={RING}
|
|
227
|
+
strokeDashoffset={RING * (1 - share)}
|
|
228
|
+
style={{ stroke: event.color }}
|
|
229
|
+
/>
|
|
230
|
+
</svg>
|
|
231
|
+
)
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
interface ActivityProps extends PartProps {
|
|
235
|
+
/** Formats the times. Defaults to the browser's locale. */
|
|
236
|
+
locale?: Intl.LocalesArgument
|
|
237
|
+
/** Called by the Join button, shown when the event has a `meetingUrl`. */
|
|
238
|
+
onJoin?: (event: AgendaEvent) => void
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
/** The open island's "Up next" view: the next event alone, as the agenda's hero. */
|
|
242
|
+
function AgendaUpNext({ event, locale, onJoin }: ActivityProps) {
|
|
243
|
+
const now = event.start - useUntil(event.start)
|
|
244
|
+
return (
|
|
245
|
+
<Widget>
|
|
246
|
+
<Hero event={event} now={now} midnight={new Date(now).setHours(24, 0, 0, 0)} locale={locale} onJoin={onJoin} />
|
|
247
|
+
</Widget>
|
|
248
|
+
)
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
/** The island's flash a minute before the start: the calendar's color, the title, how soon and where, and Join. */
|
|
252
|
+
function AgendaStarting({ event, onJoin }: Omit<ActivityProps, 'locale'>) {
|
|
253
|
+
const left = useUntil(event.start, SECOND)
|
|
254
|
+
const when = left > 0 ? `Starts in ${formatShort(left / SECOND)}` : 'Starting now'
|
|
255
|
+
return (
|
|
256
|
+
<IslandFlash
|
|
257
|
+
icon={
|
|
258
|
+
<span
|
|
259
|
+
className="flex size-9 items-center justify-center rounded-lg"
|
|
260
|
+
style={{ color: event.color, backgroundColor: `color-mix(in oklab, ${event.color} 22%, transparent)` }}
|
|
261
|
+
>
|
|
262
|
+
{event.meetingUrl ? <Video size={16} strokeWidth={1.5} /> : <CalendarDays size={16} strokeWidth={1.5} />}
|
|
263
|
+
</span>
|
|
264
|
+
}
|
|
265
|
+
title={event.title}
|
|
266
|
+
caption={event.location ? `${when} · ${event.location}` : when}
|
|
267
|
+
action={event.meetingUrl && <Join event={event} size="compact" onJoin={onJoin} />}
|
|
268
|
+
/>
|
|
269
|
+
)
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
/**
|
|
273
|
+
* A notch app's calendar: the next event as the hero, the rest of today and
|
|
274
|
+
* tomorrow beside it.
|
|
275
|
+
*
|
|
276
|
+
* The hero is how soon the next event is, set large: `in 12 min` within the
|
|
277
|
+
* hour, `Now` with the time left while it runs, else its start time. Under
|
|
278
|
+
* it the title after its calendar's color, the time range, the place and
|
|
279
|
+
* whether it's a call, and a Join button when it has a `meetingUrl`. Today's
|
|
280
|
+
* all-day events are chips on the date line above. Beside it, past a
|
|
281
|
+
* hairline, the timeline: the rest of today as rows of start time, color
|
|
282
|
+
* mark and title, then tomorrow folded to its first event
|
|
283
|
+
* (`tomorrowOpen` / `onTomorrowOpenChange`, or kept here). Ended events drop
|
|
284
|
+
* off; `now` follows the clock on each minute unless you pin it.
|
|
285
|
+
*
|
|
286
|
+
* Before the calendar may be read it asks to connect
|
|
287
|
+
* (`access="undetermined"`), and when access is off it says where to turn it
|
|
288
|
+
* on (`"denied"`).
|
|
289
|
+
*
|
|
290
|
+
* The countdown to the next event is an activity of parts:
|
|
291
|
+
* `Agenda.Leading` and `Agenda.Trailing` for the compact island's wings (the
|
|
292
|
+
* glyph in the event's color, and its dot with `12m` that turns to seconds
|
|
293
|
+
* in the last minute), `Agenda.Minimal`, a ring in its color that empties
|
|
294
|
+
* toward the start, for the split island's bubble, `Agenda.UpNext` for the
|
|
295
|
+
* open island and `Agenda.Starting`, the flash a minute before. Each
|
|
296
|
+
* re-renders only on the edge of the unit it shows.
|
|
297
|
+
*
|
|
298
|
+
* @example {@include ./examples.mdx}
|
|
299
|
+
*/
|
|
300
|
+
const Agenda = Object.assign(
|
|
301
|
+
function Agenda({
|
|
302
|
+
events,
|
|
303
|
+
access = 'granted',
|
|
304
|
+
now: nowProp,
|
|
305
|
+
locale,
|
|
306
|
+
tomorrowOpen: tomorrowOpenProp,
|
|
307
|
+
defaultTomorrowOpen = false,
|
|
308
|
+
onTomorrowOpenChange,
|
|
309
|
+
onRequestAccess,
|
|
310
|
+
onOpenSettings,
|
|
311
|
+
onJoin,
|
|
312
|
+
className,
|
|
313
|
+
}: AgendaProps) {
|
|
314
|
+
const ticking = useEdgeClock(0, nowProp === undefined, MINUTE)
|
|
315
|
+
const now = nowProp ?? ticking
|
|
316
|
+
const [tomorrowOpen, setTomorrowOpen] = useControllableState(
|
|
317
|
+
tomorrowOpenProp,
|
|
318
|
+
defaultTomorrowOpen,
|
|
319
|
+
onTomorrowOpenChange,
|
|
320
|
+
)
|
|
321
|
+
|
|
322
|
+
if (access === 'undetermined')
|
|
323
|
+
return (
|
|
324
|
+
<Widget.Message
|
|
325
|
+
icon={CalendarDays}
|
|
326
|
+
title="See what's next"
|
|
327
|
+
description="Your next event with a countdown, and the rest of today and tomorrow."
|
|
328
|
+
actions={
|
|
329
|
+
<Button variant="primary" size="compact" onClick={onRequestAccess}>
|
|
330
|
+
Connect calendar
|
|
331
|
+
</Button>
|
|
332
|
+
}
|
|
333
|
+
className={className}
|
|
334
|
+
/>
|
|
335
|
+
)
|
|
336
|
+
|
|
337
|
+
if (access === 'denied')
|
|
338
|
+
return (
|
|
339
|
+
<Widget.Message
|
|
340
|
+
icon={Lock}
|
|
341
|
+
title="Calendar access is off"
|
|
342
|
+
description="Turn it on in System Settings › Privacy & Security › Calendars."
|
|
343
|
+
actions={
|
|
344
|
+
<Button variant="secondary" size="compact" onClick={onOpenSettings}>
|
|
345
|
+
Open System Settings
|
|
346
|
+
</Button>
|
|
347
|
+
}
|
|
348
|
+
className={className}
|
|
349
|
+
/>
|
|
350
|
+
)
|
|
351
|
+
|
|
352
|
+
const midnight = new Date(now).setHours(24, 0, 0, 0)
|
|
353
|
+
const next = new Date(midnight).setHours(24, 0, 0, 0)
|
|
354
|
+
const live = events.filter(event => event.end > now && event.start < next).sort((a, b) => a.start - b.start)
|
|
355
|
+
const allDay = live.filter(event => event.allDay && event.start < midnight)
|
|
356
|
+
const timed = live.filter(event => !event.allDay)
|
|
357
|
+
const [hero] = timed
|
|
358
|
+
|
|
359
|
+
if (!hero)
|
|
360
|
+
return (
|
|
361
|
+
<Widget.Message
|
|
362
|
+
icon={CalendarCheck}
|
|
363
|
+
title={allDay.length ? allDay.map(event => event.title).join(', ') : 'Nothing planned'}
|
|
364
|
+
description={
|
|
365
|
+
allDay.length ? 'All day today; nothing else on the calendar.' : 'No more events today or tomorrow.'
|
|
366
|
+
}
|
|
367
|
+
className={className}
|
|
368
|
+
/>
|
|
369
|
+
)
|
|
370
|
+
|
|
371
|
+
const today = timed.filter(event => event !== hero && event.start < midnight)
|
|
372
|
+
const tomorrow = timed.filter(event => event !== hero && event.start >= midnight)
|
|
373
|
+
const tomorrowShown = tomorrowOpen ? tomorrow.slice(0, ROWS) : tomorrow.slice(0, 1)
|
|
374
|
+
const date = new Date(now).toLocaleDateString(locale, { weekday: 'long', month: 'long', day: 'numeric' })
|
|
375
|
+
|
|
376
|
+
return (
|
|
377
|
+
<Widget
|
|
378
|
+
className={className}
|
|
379
|
+
aside={
|
|
380
|
+
<>
|
|
381
|
+
<Widget.Section label="Later today">
|
|
382
|
+
{today.length ? (
|
|
383
|
+
<Rows events={today.slice(0, ROWS)} locale={locale} />
|
|
384
|
+
) : (
|
|
385
|
+
<span className="flex h-7 items-center text-body text-muted-foreground">Nothing else today</span>
|
|
386
|
+
)}
|
|
387
|
+
<More count={today.length - ROWS} />
|
|
388
|
+
</Widget.Section>
|
|
389
|
+
{tomorrow.length > 0 && (
|
|
390
|
+
<Widget.Section
|
|
391
|
+
className="mt-1"
|
|
392
|
+
label="Tomorrow"
|
|
393
|
+
trailing={
|
|
394
|
+
tomorrow.length > 1 && (
|
|
395
|
+
<Button
|
|
396
|
+
variant="ghost"
|
|
397
|
+
size="compact"
|
|
398
|
+
className="-mr-2 h-6 px-2"
|
|
399
|
+
aria-expanded={tomorrowOpen}
|
|
400
|
+
trailingIcon={tomorrowOpen ? ChevronUp : ChevronDown}
|
|
401
|
+
onClick={() => setTomorrowOpen(!tomorrowOpen)}
|
|
402
|
+
>
|
|
403
|
+
{tomorrowOpen ? 'Less' : `${tomorrow.length - 1} more`}
|
|
404
|
+
</Button>
|
|
405
|
+
)
|
|
406
|
+
}
|
|
407
|
+
>
|
|
408
|
+
<Rows events={tomorrowShown} locale={locale} />
|
|
409
|
+
{tomorrowOpen && <More count={tomorrow.length - ROWS} />}
|
|
410
|
+
</Widget.Section>
|
|
411
|
+
)}
|
|
412
|
+
</>
|
|
413
|
+
}
|
|
414
|
+
>
|
|
415
|
+
<Widget.Header
|
|
416
|
+
icon={CalendarDays}
|
|
417
|
+
trailing={allDay.map(event => (
|
|
418
|
+
<Widget.Chip key={event.id} color={event.color}>
|
|
419
|
+
{event.title}
|
|
420
|
+
</Widget.Chip>
|
|
421
|
+
))}
|
|
422
|
+
>
|
|
423
|
+
{date}
|
|
424
|
+
</Widget.Header>
|
|
425
|
+
<Hero event={hero} now={now} midnight={midnight} locale={locale} onJoin={onJoin} />
|
|
426
|
+
</Widget>
|
|
427
|
+
)
|
|
428
|
+
},
|
|
429
|
+
{
|
|
430
|
+
Leading: AgendaLeading,
|
|
431
|
+
Trailing: AgendaTrailing,
|
|
432
|
+
Minimal: AgendaMinimal,
|
|
433
|
+
UpNext: AgendaUpNext,
|
|
434
|
+
Starting: AgendaStarting,
|
|
435
|
+
},
|
|
436
|
+
)
|
|
437
|
+
|
|
438
|
+
export default Agenda
|
|
439
|
+
|
|
440
|
+
export type { AgendaAccess, AgendaEvent, AgendaProps }
|
|
441
|
+
export { Agenda, AgendaLeading, AgendaMinimal, AgendaStarting, AgendaTrailing, AgendaUpNext }
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import Clock from './index'
|
|
2
|
+
import { WidgetIsland } from '../../../mock/island-content'
|
|
3
|
+
import { CLOCK_NOW, ClockSplit, ClockWings, FocusClock, PausedBreak, PhaseDoneFlash, ZONES } from '../../../mock/clock'
|
|
4
|
+
|
|
5
|
+
# Clock
|
|
6
|
+
|
|
7
|
+
The time as the hero, the date above it and the time zone under it, the Pomodoro waiting with its lengths; beside it the world clocks, each with how far it is, day or night, and Tomorrow when its date differs.
|
|
8
|
+
|
|
9
|
+
<WidgetIsland tab="clock">
|
|
10
|
+
<Clock zones={ZONES} now={CLOCK_NOW} />
|
|
11
|
+
</WidgetIsland>
|
|
12
|
+
|
|
13
|
+
# 24 hours, with seconds
|
|
14
|
+
|
|
15
|
+
`hour12={false}` and `seconds`: the seconds tick muted, on each second's edge.
|
|
16
|
+
|
|
17
|
+
<WidgetIsland tab="clock">
|
|
18
|
+
<Clock zones={ZONES} hour12={false} seconds pomodoro={{ focus: 50, shortBreak: 10, longBreak: 30, rounds: 3 }} />
|
|
19
|
+
</WidgetIsland>
|
|
20
|
+
|
|
21
|
+
# Focus
|
|
22
|
+
|
|
23
|
+
A run takes the widget over: the ring in the phase's hue, the time left, the round, when it ends and what's next, and the next phases with their start times. Pause, skip, +1 min or reset it.
|
|
24
|
+
|
|
25
|
+
<WidgetIsland tab="clock">
|
|
26
|
+
<FocusClock />
|
|
27
|
+
</WidgetIsland>
|
|
28
|
+
|
|
29
|
+
# A break, paused
|
|
30
|
+
|
|
31
|
+
A paused phase keeps the time it had left and says so.
|
|
32
|
+
|
|
33
|
+
<WidgetIsland tab="clock">
|
|
34
|
+
<PausedBreak />
|
|
35
|
+
</WidgetIsland>
|
|
36
|
+
|
|
37
|
+
# Ready to start
|
|
38
|
+
|
|
39
|
+
`Start focus` begins the first round; at a phase's end the next one waits here, paused at its whole length.
|
|
40
|
+
|
|
41
|
+
<WidgetIsland tab="clock">
|
|
42
|
+
<Clock zones={ZONES} now={CLOCK_NOW} defaultValue={{ phase: 'long-break', round: 4, total: 15 * 60_000, remaining: 15 * 60_000 }} />
|
|
43
|
+
</WidgetIsland>
|
|
44
|
+
|
|
45
|
+
# Clock only
|
|
46
|
+
|
|
47
|
+
`pomodoro={false}` leaves the Pomodoro out.
|
|
48
|
+
|
|
49
|
+
<WidgetIsland tab="clock">
|
|
50
|
+
<Clock zones={ZONES.slice(0, 2)} now={CLOCK_NOW} pomodoro={false} />
|
|
51
|
+
</WidgetIsland>
|
|
52
|
+
|
|
53
|
+
# Compact
|
|
54
|
+
|
|
55
|
+
`Clock.Leading` and `Clock.Trailing` in the wings while a phase runs: the ring and the time left. Without a run they show nothing.
|
|
56
|
+
|
|
57
|
+
<ClockWings />
|
|
58
|
+
|
|
59
|
+
# Minimal
|
|
60
|
+
|
|
61
|
+
`Clock.Minimal`, the ring, in the split island's bubble.
|
|
62
|
+
|
|
63
|
+
<ClockSplit />
|
|
64
|
+
|
|
65
|
+
# Focus done
|
|
66
|
+
|
|
67
|
+
`Clock.PhaseDone` at the end of a focus round, with a button to start the break.
|
|
68
|
+
|
|
69
|
+
<PhaseDoneFlash ended={{ phase: 'focus', round: 2 }} />
|
|
70
|
+
|
|
71
|
+
# Break over
|
|
72
|
+
|
|
73
|
+
<PhaseDoneFlash ended={{ phase: 'short-break', round: 2 }} />
|