Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
3891910
通知の送り先の種類と出来事の言い方を決める関数を足す
fyui001 Nov 9, 2026
2224571
ベルの図と通知の言い方の関数を足す
fyui001 Nov 9, 2026
4515049
設定の通知の画面の部品と物語を足す
fyui001 Nov 9, 2026
a233559
単発の通知のボタンと札とベルと予約一覧の行の物語を足す
fyui001 Nov 9, 2026
697d4bd
通知の物語が試験と読み上げの関門を通るように直す
fyui001 Nov 9, 2026
267dda0
通知を設定の一覧と電話の帯に出し、対話の脚をほかの対話と同じ中央にそろえる
fyui001 Nov 9, 2026
1e379d4
送り先とルールセットの行の操作を … のメニューにまとめ、種類の札に色を付ける
fyui001 Nov 10, 2026
6146f5e
Merge remote-tracking branch 'origin/chore/storybook-order' into feat…
fyui001 Nov 10, 2026
c13bbb0
通知の物語を新しい区分けに移し、通常から電話の順に並べる
fyui001 Nov 10, 2026
4aaec7d
Merge remote-tracking branch 'origin/chore/storybook-order' into feat…
fyui001 Nov 10, 2026
9e45c56
Merge remote-tracking branch 'origin/master' into feat/notification-c…
fyui001 Nov 10, 2026
b8bd553
通知の API を OpenAPI の文書と生成した型に取り込む
fyui001 Nov 10, 2026
23686a6
通知の画面の型を API の形に合わせ、送り先の削除で一緒に消えるルールセットの名前を出す
fyui001 Nov 10, 2026
0ee1b9b
通知の送り先・ルールセット・設定・配送の記録を Carina の API から読み書きする
fyui001 Nov 10, 2026
92b3b56
設定に通知の画面を足し、設定の一覧の管理にいつも通知を出す
fyui001 Nov 10, 2026
ba957b7
単発の通知の API を OpenAPI の文書と生成した型に取り込む
fyui001 Nov 10, 2026
d6c301a
単発の通知を API から読み、頼み、取り消せるようにする
fyui001 Nov 10, 2026
f91e6a1
番組詳細の録画予約の隣に放送開始の通知を頼むボタンを置く
fyui001 Nov 10, 2026
8255089
放送開始を通知する番組は番組表の札の角にベルを出す
fyui001 Nov 10, 2026
13dee10
予約一覧に放送開始の通知の行を並べる
fyui001 Nov 10, 2026
8efe32f
直近の結果が無い送り先の行は PC の幅で 1 行にする
fyui001 Nov 10, 2026
1c59b2d
通知の試験の見本の番地を別の私設アドレスに替える
fyui001 Nov 10, 2026
424a0c9
Carina に届かなかった通知の書き込みは、画面を置き換えずに断りの文で返す
fyui001 Nov 10, 2026
1b9c369
頼んである通知を読めなかったときは、番組の詳細に放送開始を通知のボタンを出さない
fyui001 Nov 10, 2026
f56c07a
別の画面で消された送り先やルールセットを保存・削除したときの断りを、行が消えたあとも読めるトーストに出す
fyui001 Nov 10, 2026
196a4ff
横向きの電話の番組検索で開く詳細にも、まだ始まっていない番組なら録画予約の隣に放送開始の通知を置く
fyui001 Nov 10, 2026
f10b65d
通知の操作を断られたときの画面の試験を足す
fyui001 Nov 10, 2026
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
34 changes: 34 additions & 0 deletions app/(app)/guide/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,13 @@ import type {
RebuildResult,
} from '@/repository/collection'
import { collectNow, rebuildEpg } from '@/repository/collection'
import type {
NotificationWrite,
WatchDraft,
WatchWrite,
} from '@/lib/notifications'
import { wasAnswered } from '@/lib/notifications'
import { askForWatch, cancelWatch } from '@/repository/notifications'
import type { ProgramExtras } from '@/repository/programs'
import { extrasOf } from '@/repository/programs'
import type {
Expand Down Expand Up @@ -97,3 +104,30 @@ export async function readProgramExtras(
): Promise<ProgramExtras | undefined> {
return extrasOf(kind, date, id, channelId)
}

export async function watchProgramme(
programmeId: string,
draft: WatchDraft,
): Promise<WatchWrite> {
const result = await askForWatch(programmeId, draft)

if (wasAnswered(result)) {
revalidatePath('/guide')
revalidatePath('/reservations')
revalidatePath('/search')
}

return result
}

export async function unwatchProgramme(id: string): Promise<NotificationWrite> {
const result = await cancelWatch(id)

if (wasAnswered(result)) {
revalidatePath('/guide')
revalidatePath('/reservations')
revalidatePath('/search')
}

return result
}
13 changes: 12 additions & 1 deletion app/(app)/guide/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { cookies } from 'next/headers'

import { forTheGrid, getGuideInTwo } from '@/repository/programs'
import { listBookings } from '@/repository/reservations'
import { readSingleNotices } from '@/repository/notifications'
import {
coverageDaysOf,
epgHealthOf,
Expand All @@ -29,6 +30,8 @@ import {
reserveProgramme,
readProgramExtras,
reviseProgrammeReservation,
unwatchProgramme,
watchProgramme,
} from './actions'

export const metadata: Metadata = { title: '番組表' }
Expand All @@ -40,13 +43,16 @@ export default async function Page({
}) {
const params = await searchParams
const jar = await cookies()
const [{ guide, rest }, collection] = await Promise.all([
const notices = readSingleNotices()
const [{ guide, rest }, collection, offer] = await Promise.all([
getGuideInTwo(
typeof params.kind === 'string' ? params.kind : undefined,
typeof params.date === 'string' ? params.date : undefined,
listBookings(),
notices.watches,
),
getCollectionStatus(),
notices.offer,
])
const opening = guide.programs.length > 0 ? guide.programs : await rest
const later =
Expand Down Expand Up @@ -75,6 +81,11 @@ export default async function Page({
onRestore={restoreProgrammeReservation}
onRevise={reviseProgrammeReservation}
onReadExtras={readProgramExtras}
noticing={{
offer,
onWatch: watchProgramme,
onUnwatch: unwatchProgramme,
}}
subChannelsFolded={flagOf(
jar.get(GUIDE_SUB_CHANNELS_FOLDED)?.value,
FOLD_SPELLING,
Expand Down
14 changes: 13 additions & 1 deletion app/(app)/guide/programs/[programKey]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,15 @@ import { notFound, redirect } from 'next/navigation'
import { PROGRAMS_EVENT, RESERVATIONS_EVENT } from '@/repository/events'
import { getProgram, primaryProgramKeyOf } from '@/repository/programs'
import { listBookings } from '@/repository/reservations'
import { readSingleNotices } from '@/repository/notifications'
import { RefreshOnSignal } from '@/components/vela/app-signals'
import { ProgramDetailView } from '@/components/guide/program-detail-page'
import {
dropProgrammeReservation,
reserveProgramme,
reviseProgrammeReservation,
unwatchProgramme,
watchProgramme,
} from '@/app/(app)/guide/actions'

export async function generateMetadata({
Expand All @@ -28,7 +31,11 @@ export default async function Page({
params: Promise<{ programKey: string }>
}) {
const { programKey } = await params
const detail = await getProgram(programKey, new Date(), listBookings())
const notices = readSingleNotices()
const [detail, offer] = await Promise.all([
getProgram(programKey, new Date(), listBookings(), notices.watches),
notices.offer,
])
if (!detail) {
const primary = await primaryProgramKeyOf(programKey)

Expand All @@ -47,6 +54,11 @@ export default async function Page({
onReserve={reserveProgramme}
onCancel={dropProgrammeReservation}
onRevise={reviseProgrammeReservation}
noticing={{
offer,
onWatch: watchProgramme,
onUnwatch: unwatchProgramme,
}}
/>
</>
)
Expand Down
6 changes: 5 additions & 1 deletion app/(app)/reservations/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { RESERVATIONS_EVENT } from '@/repository/events'
import type { EpgDriftKind } from '@/repository/reservations'
import { listReservations } from '@/repository/reservations'
import { getTuners } from '@/repository/tuners'
import { listWatchedProgrammes } from '@/repository/notifications'
import { RefreshOnSignal } from '@/components/vela/app-signals'
import { ReservationsView } from '@/components/reservations/reservations-page'
import {
Expand All @@ -15,6 +16,7 @@ import {
throwReservationAway,
throwReservationsAway,
} from '@/app/(app)/reservations/actions'
import { unwatchProgramme } from '@/app/(app)/guide/actions'

export const metadata: Metadata = { title: '予約' }

Expand All @@ -24,12 +26,13 @@ export default async function Page({
searchParams: Promise<Record<string, string | string[] | undefined>>
}) {
const params = await searchParams
const [result, tuners] = await Promise.all([
const [result, tuners, watches] = await Promise.all([
listReservations({
show: params.show === 'all' ? 'all' : undefined,
epg: driftAsked(params.epg),
}),
getTuners().catch(() => undefined),
listWatchedProgrammes().catch(() => []),
])

return (
Expand All @@ -49,6 +52,7 @@ export default async function Page({
onCancelAll: dropReservations,
onDiscardAll: throwReservationsAway,
}}
notices={{ watches, onCancel: unwatchProgramme }}
/>
</>
)
Expand Down
14 changes: 13 additions & 1 deletion app/(app)/search/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,13 @@ import type { Metadata } from 'next'

import { rawSearchConditionOf } from '@/lib/search-condition'
import { searchPrograms } from '@/repository/search'
import { readSingleNotices } from '@/repository/notifications'
import {
dropProgrammeReservation,
reserveProgramme,
restoreProgrammeReservation,
unwatchProgramme,
watchProgramme,
} from '../guide/actions'
import { SearchView } from '@/components/search/search-page'

Expand All @@ -17,14 +20,23 @@ export default async function Page({
searchParams: Promise<Record<string, string | string[] | undefined>>
}) {
const params = await searchParams
const result = await searchPrograms(rawSearchConditionOf(params))
const notices = readSingleNotices()
const [result, offer] = await Promise.all([
searchPrograms(rawSearchConditionOf(params), notices.watches),
notices.offer,
])

return (
<SearchView
result={result}
onReserve={reserveProgramme}
onCancel={dropProgrammeReservation}
onRestore={restoreProgrammeReservation}
noticing={{
offer,
onWatch: watchProgramme,
onUnwatch: unwatchProgramme,
}}
/>
)
}
94 changes: 94 additions & 0 deletions app/(app)/settings/notifications/actions.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
'use server'

import { revalidatePath } from 'next/cache'

import type {
DestinationRevision,
LeadMinutes,
NotificationWrite,
RuleSetDraft,
TestSending,
WebhookDraft,
} from '@/lib/notifications'
import { wasAnswered } from '@/lib/notifications'
import {
defineRuleSet,
registerDestination,
removeDestination,
removeRuleSet,
reviseDestination,
reviseRuleSet,
settleLead,
switchDestination,
switchRuleSet,
tryDestination,
} from '@/repository/notifications'

const NOTIFICATIONS = '/settings/notifications'

/** The page is read again once Carina has answered; a write that never reached it leaves the page as it is. */
function readAgain<T extends NotificationWrite | TestSending>(result: T): T {
if (wasAnswered(result)) {
revalidatePath(NOTIFICATIONS)
}

return result
}

export async function addDestination(
draft: WebhookDraft,
): Promise<NotificationWrite> {
return readAgain(await registerDestination(draft))
}

export async function changeDestination(
id: string,
revision: DestinationRevision,
): Promise<NotificationWrite> {
return readAgain(await reviseDestination(id, revision))
}

export async function turnDestination(
id: string,
enabled: boolean,
): Promise<NotificationWrite> {
return readAgain(await switchDestination(id, enabled))
}

export async function sendTrial(id: string): Promise<TestSending> {
return readAgain(await tryDestination(id))
}

export async function dropDestination(id: string): Promise<NotificationWrite> {
return readAgain(await removeDestination(id))
}

export async function addRuleSet(
draft: RuleSetDraft,
): Promise<NotificationWrite> {
return readAgain(await defineRuleSet(draft))
}

export async function changeRuleSet(
id: string,
draft: RuleSetDraft,
): Promise<NotificationWrite> {
return readAgain(await reviseRuleSet(id, draft))
}

export async function turnRuleSet(
id: string,
enabled: boolean,
): Promise<NotificationWrite> {
return readAgain(await switchRuleSet(id, enabled))
}

export async function dropRuleSet(id: string): Promise<NotificationWrite> {
return readAgain(await removeRuleSet(id))
}

export async function settleTheLead(
lead: LeadMinutes,
): Promise<NotificationWrite> {
return readAgain(await settleLead(lead))
}
40 changes: 40 additions & 0 deletions app/(app)/settings/notifications/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import type { Metadata } from 'next'

import { getNotificationsScreen } from '@/repository/notifications'
import { NotificationsView } from '@/components/notifications/notifications-page'
import {
addDestination,
addRuleSet,
changeDestination,
changeRuleSet,
dropDestination,
dropRuleSet,
sendTrial,
settleTheLead,
turnDestination,
turnRuleSet,
} from './actions'

export const metadata: Metadata = { title: '通知' }

export default async function Page() {
const screen = await getNotificationsScreen()

return (
<NotificationsView
screen={screen}
actions={{
onAddWebhook: addDestination,
onReviseDestination: changeDestination,
onToggleDestination: turnDestination,
onTestDestination: sendTrial,
onRemoveDestination: dropDestination,
onAddRuleSet: addRuleSet,
onReviseRuleSet: changeRuleSet,
onToggleRuleSet: turnRuleSet,
onRemoveRuleSet: dropRuleSet,
onSettleLead: settleTheLead,
}}
/>
)
}
24 changes: 24 additions & 0 deletions app/globals.css
Original file line number Diff line number Diff line change
Expand Up @@ -2803,6 +2803,30 @@
}
}

/* The bell of a programme whose start is to be told sits in the cell's top
right corner, and in the middle of a cell of one line. */
@utility guide-cell-bell {
@apply pointer-events-none absolute right-2 text-warn;
top: calc(7rem / 16);
width: calc(15rem / 16);
height: calc(15rem / 16);

& svg {
stroke-width: 1.9;
}

@container (height < 2.5rem) {
top: 50%;
width: min(calc(15rem / 16), 80cqh);
height: min(calc(15rem / 16), 80cqh);
translate: 0 -50%;
}

@container (height < 0.75rem) {
display: none;
}
}

@utility guide-cell-desc {
@apply mt-0.5 block text-note text-ink-2;
line-height: var(--guide-pitch);
Expand Down
8 changes: 8 additions & 0 deletions components/guide/channel-day-list.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ import {
groundOf,
} from '@/components/guide/guide-metrics'
import { ChevronDownIcon, ChevronUpIcon } from '@/components/vela/icons'
import { WATCHED_SAYS } from '@/components/guide/program-cell'
import { NotifyBell } from '@/components/notifications/programme-notice'
import { pressable } from '@/components/vela/tactile'

const ROOM_ABOVE_NOW_PX = 48
Expand Down Expand Up @@ -255,6 +257,12 @@ export function ChannelDayList({
)}
/>
{mark && <BookingGlyph mark={mark} />}
{p.watch && (
<NotifyBell
label={WATCHED_SAYS}
className="mr-1.5 align-[-2px]"
/>
)}
{halfWidthOf(p.title)}
</span>
<span
Expand Down
Loading
Loading