dock config to postgres, auto-add /email on google oauth, improved email empty state

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-26 17:42:27 +00:00
co-authored by Claude Opus 4.6
parent 466dc3adda
commit 7f04ecd644
7 changed files with 214 additions and 93 deletions
@@ -1,12 +1,21 @@
import { useEffect, useRef, useState } from 'react';
import { Link } from 'react-router';
import { useQuery, useQueryClient } from '@tanstack/react-query';
import { ChevronLeft, ChevronRight, Loader2, Mail, Paperclip, RefreshCw } from 'lucide-react';
import { toast } from 'sonner';
import { Button } from '@/components/ui/button';
import { useClient } from 'hooks/useClient';
import { useGlobal } from 'hooks/useGlobal';
import { useJobs } from 'hooks/useJobs';
import type { EmailSummary } from 'types';
type GoogleStatus = {
configured: boolean;
connected: boolean;
email: string | null;
picture: string | null;
};
const LIMIT = 50;
const formatDate = (iso: string) => {
@@ -27,6 +36,11 @@ export const EmailList = () => {
const { jobs, createJob } = useJobs({ type: 'gmail-sync' });
const isSyncing = jobs.some((j) => j.status === 'queued' || j.status === 'running');
const { data: googleStatus } = useQuery({
queryKey: ['google-status'],
queryFn: () => client.get<GoogleStatus>('/integrations/google/status'),
});
const { data, isLoading } = useQuery({
queryKey: ['email-messages', page],
queryFn: () =>
@@ -65,9 +79,26 @@ export const EmailList = () => {
if (messages.length === 0 && page === 1) {
return (
<div className="flex h-full flex-col items-center justify-center gap-2 text-sm opacity-50">
<div className="flex h-full flex-col items-center justify-center gap-3 text-sm opacity-50">
<Mail className="h-8 w-8" />
No emails found
{googleStatus && !googleStatus.configured ? (
<span>Google integration not configured. Contact your administrator.</span>
) : googleStatus && !googleStatus.connected ? (
<div className="flex flex-col items-center gap-2">
<span>Connect your Google account to sync emails</span>
<Button variant="outline" size="sm" asChild>
<Link to="/settings/integrations">Connect Google</Link>
</Button>
</div>
) : (
<div className="flex flex-col items-center gap-2">
<span>No emails synced yet</span>
<Button variant="outline" size="sm" onClick={handleSync} disabled={isSyncing}>
{isSyncing ? <Loader2 className="mr-2 h-3.5 w-3.5 animate-spin" /> : <RefreshCw className="mr-2 h-3.5 w-3.5" />}
Sync Now
</Button>
</div>
)}
</div>
);
}