Add refresh controls and notification support

- Add refresh button to product list items with spinning animation
- Add editable refresh interval dropdown on product detail page
- Add user profile dropdown with settings link in navbar
- Create Settings page for Telegram and Discord configuration
- Add per-product notification options (price drop threshold, back in stock)
- Integrate notifications into scheduler for automatic alerts
- Add notification service supporting Telegram Bot API and Discord webhooks

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
clucraft 2026-01-20 21:15:04 -05:00
parent 8c5d20707d
commit a6928a0c17
13 changed files with 1373 additions and 21 deletions

View file

@ -57,6 +57,8 @@ export interface Product {
refresh_interval: number;
last_checked: string | null;
stock_status: StockStatus;
price_drop_threshold: number | null;
notify_back_in_stock: boolean;
created_at: string;
current_price: number | null;
currency: string | null;
@ -89,8 +91,12 @@ export const productsApi = {
create: (url: string, refreshInterval?: number) =>
api.post<Product>('/products', { url, refresh_interval: refreshInterval }),
update: (id: number, data: { name?: string; refresh_interval?: number }) =>
api.put<Product>(`/products/${id}`, data),
update: (id: number, data: {
name?: string;
refresh_interval?: number;
price_drop_threshold?: number | null;
notify_back_in_stock?: boolean;
}) => api.put<Product>(`/products/${id}`, data),
delete: (id: number) => api.delete(`/products/${id}`),
};
@ -109,4 +115,28 @@ export const pricesApi = {
),
};
// Settings API
export interface NotificationSettings {
telegram_configured: boolean;
telegram_chat_id: string | null;
discord_configured: boolean;
}
export const settingsApi = {
getNotifications: () =>
api.get<NotificationSettings>('/settings/notifications'),
updateNotifications: (data: {
telegram_bot_token?: string | null;
telegram_chat_id?: string | null;
discord_webhook_url?: string | null;
}) => api.put<NotificationSettings & { message: string }>('/settings/notifications', data),
testTelegram: () =>
api.post<{ message: string }>('/settings/notifications/test/telegram'),
testDiscord: () =>
api.post<{ message: string }>('/settings/notifications/test/discord'),
};
export default api;