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
2 changes: 2 additions & 0 deletions app/app/stream/[id]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -457,6 +457,7 @@ function AutoWithdrawSection({
key={opt.value}
type="button"
onClick={() => updateSettings({ strategy: opt.value })}
aria-pressed={settings.strategy === opt.value}
className={
"w-full text-left p-3 rounded-lg border transition-colors " +
(settings.strategy === opt.value
Expand All @@ -482,6 +483,7 @@ function AutoWithdrawSection({
key={opt.hours}
type="button"
onClick={() => updateSettings({ intervalHours: opt.hours })}
aria-pressed={settings.intervalHours === opt.hours}
className={
"rounded-full border px-3 py-1 text-xs font-medium transition-colors " +
(settings.intervalHours === opt.hours
Expand Down
1 change: 1 addition & 0 deletions app/app/streams/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ function StreamsPage() {
<button
key={f.value}
onClick={() => setParam('status', f.value)}
aria-pressed={statusFilter === f.value}
className={
'rounded-full border px-3 py-1 text-xs font-medium transition-colors ' +
(statusFilter === f.value
Expand Down
8 changes: 4 additions & 4 deletions lib/recurring.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@ export function getRecurringRules(): RecurringRule[] {
}
}

export function saveRecurringRule(rule: RecurringRule) {
export function saveRecurringRule(rule: RecurringRule): void {
if (typeof window === 'undefined') return
const rules = getRecurringRules().filter((item) => item.streamId !== rule.streamId)
rules.unshift(rule)
window.localStorage.setItem(STORAGE_KEY, JSON.stringify(rules.slice(0, 25)))
}

export function removeRecurringRule(streamId: string) {
export function removeRecurringRule(streamId: string): void {
if (typeof window === 'undefined') return
const rules = getRecurringRules().filter((item) => item.streamId !== streamId)
window.localStorage.setItem(STORAGE_KEY, JSON.stringify(rules))
Expand Down Expand Up @@ -76,7 +76,7 @@ export function getUpcomingRenewals(): RecurringRule[] {
* buildNextRunAt(new Date('2025-01-31').getTime(), 'monthly');
* // → 2025-02-28T00:00:00.000 (clamped — Feb has no 31st)
*/
export function buildNextRunAt(startTime: number, cadence: Exclude<RecurrenceCadence, 'none'>) {
export function buildNextRunAt(startTime: number, cadence: Exclude<RecurrenceCadence, 'none'>): number {
if (cadence === 'weekly') {
return startTime + 7 * 24 * 60 * 60 * 1000
}
Expand All @@ -99,7 +99,7 @@ export function buildNextRunAt(startTime: number, cadence: Exclude<RecurrenceCad
return date.getTime()
}

export function createRenewalPreset(stream: { id: string; recipient: string; token: { symbol: string }; depositedAmount: bigint }, cadence: Exclude<RecurrenceCadence, 'none'>) {
export function createRenewalPreset(stream: { id: string; recipient: string; token: { symbol: string }; depositedAmount: bigint }, cadence: Exclude<RecurrenceCadence, 'none'>): RecurringRule {
const preset = {
streamId: stream.id,
recipient: stream.recipient,
Expand Down