diff --git a/app/(dashboard)/integrated-calendar/components/ApiNoticeBanner.tsx b/app/(dashboard)/integrated-calendar/components/ApiNoticeBanner.tsx new file mode 100644 index 0000000..9d6e553 --- /dev/null +++ b/app/(dashboard)/integrated-calendar/components/ApiNoticeBanner.tsx @@ -0,0 +1,90 @@ +'use client'; + +import { AlertTriangle, ExternalLink } from 'lucide-react'; +import { Button } from '@/components/ui/button'; + +interface ApiNoticeBannerProps { + error?: string | null; +} + +export default function ApiNoticeBanner({ error }: ApiNoticeBannerProps) { + if (!error) return null; + + const isApiDisabledError = + error.includes('belum diaktifkan') || + error.includes('Google Calendar API has not been used') || + error.includes('disabled'); + + const isOAuthMismatchError = + error.includes('unauthorized_client') || error.includes('invalid_grant'); + + const enableUrl = + 'https://console.developers.google.com/apis/api/calendar-json.googleapis.com/overview?project=141775000325'; + const playgroundUrl = 'https://developers.google.com/oauthplayground/'; + + return ( +
+ {error} +
+ {isOAuthMismatchError && ( +https://developers.google.com/oauthplayground sudah ditambahkan ke Authorized redirect URIs pada OAuth 2.0 Client ID Anda di Google Cloud Console.
+ GOOGLE_CLIENT_ID & GOOGLE_CLIENT_SECRET Anda.
+ https://www.googleapis.com/auth/calendar > klik Authorize APIs > klik Exchange authorization code for tokens > salin Refresh token baru ke .env.development.
+ + Integrasi Server-to-Server (Single System OAuth2 Refresh Token) • Tanpa OAuth Login Pengguna +
++ {card.desc} +
++ {events.length === 0 + ? 'Tambahkan event baru untuk melakukan uji coba sinkronisasi ke Google Calendar web.' + : 'Coba ubah kata kunci pencarian Anda.'} +
+ {events.length === 0 && ( + + )} ++ {tasks.length === 0 + ? 'Tambahkan task pertama Anda. Task akan diberi penanda khusus [TASK] pada Google Calendar resmi.' + : 'Silakan reset pencarian atau filter status untuk melihat data lain.'} +
+ {tasks.length === 0 && ( + + )} ++ {item.description} +
+ )} +