Branchwell

OpenTalon / website / src / main.js

1import '@fontsource-variable/geist/wght.css'
2import '@fontsource-variable/jetbrains-mono/wght.css'
3import './style.css'
4import './devices.css'
5
6document.documentElement.classList.add('js')
7
8function el(tag, className, text) {
9 const node = document.createElement(tag)
10 if (className) node.className = className
11 if (text !== undefined) node.textContent = text
12 return node
13}
14
15/* Screen picker: swaps real captures of the Mac app inside the MacBook frame. */
16const screenShot = document.getElementById('screen-shot')
17const screenCaption = document.getElementById('screen-caption')
18const SCREENS = {
19 board: {
20 src: '/app/native/mac-board.webp',
21 alt: 'The OpenTalon Mac app on All tasks: three columns, To do, In progress and Done, with twelve cards showing priority, project, due date, agent and run state.',
22 caption: "All tasks: every project's cards on one board, filtered by priority and in the order you set.",
23 },
24 task: {
25 src: '/app/native/mac-task.webp',
26 alt: 'The OpenTalon Mac app with the task Fix sync conflict on reorder open: the project’s tasks beside the conversation, where Claude asks which order should win and offers three one-press answers.',
27 caption: 'Task thread: the agent’s messages and its question, answered with one press, beside the project’s tasks.',
28 },
29 project: {
30 src: '/app/native/mac-project.webp',
31 alt: 'The OpenTalon Mac app showing the board for one project, Launch, with its cards in the same three columns.',
32 caption: 'Project board: each project gets its own board with the same three columns.',
33 },
34 dashboard: {
35 src: '/app/native/mac-dashboard.webp',
36 alt: 'The OpenTalon Dashboard: nine open tasks with a status bar for to-dos, In progress and Done, the agent run that needs you with one-press answers, a quick add field, and a task list with urgent, overdue and due today counts.',
37 caption: 'Dashboard: what needs you, and what is urgent, overdue, or due today across every project.',
38 },
39}
40const screenButtons = document.querySelectorAll('[data-screen]')
41for (const button of screenButtons) {
42 button.addEventListener('click', () => {
43 const screen = SCREENS[button.dataset.screen]
44 screenShot.src = screen.src
45 screenShot.alt = screen.alt
46 screenCaption.textContent = screen.caption
47 for (const other of screenButtons) {
48 const active = other === button
49 other.classList.toggle('active', active)
50 other.setAttribute('aria-pressed', String(active))
51 }
52 })
53 button.addEventListener('pointerenter', () => {
54 new Image().src = SCREENS[button.dataset.screen].src
55 }, { once: true })
56}
57
58
59/* Reveal on scroll */
60const revealed = document.querySelectorAll('.reveal')
61if ('IntersectionObserver' in window) {
62 const observer = new IntersectionObserver(
63 (entries) => {
64 for (const entry of entries) {
65 if (entry.isIntersecting) {
66 entry.target.classList.add('in')
67 observer.unobserve(entry.target)
68 }
69 }
70 },
71 { rootMargin: '0px 0px -8% 0px' },
72 )
73 for (const node of revealed) observer.observe(node)
74} else {
75 for (const node of revealed) node.classList.add('in')
76}