Bildirim Sistemi (Uygulama İçi)
Uygulama içi bildirimlerin bölgeye göre dili, dropdown ve account/notifications sayfası.
Achidemy’de uygulama içi bildirimler (satış, kurs onay/red, ödeme onay/red, QnA vb.) hem içerik (başlık/mesaj) hem arayüz (dropdown ve bildirimler sayfası metinleri) olarak kullanıcının bölgesine göre dil alır. Arayüz dil seçimi (Deutsch, Türkçe vb.) kullanılmaz; varsayılan dil İngilizce’dir (bölge dilimizde yoksa).
Dil Kaynağı: users.country
Section titled “Dil Kaynağı: users.country”Bildirim dili veritabanındaki kullanıcı ülkesi ile belirlenir:
- Fonksiyon:
getNotificationLangForUser(db, userId)(app/lib/notifications.ts) - Eşleme: TR → tr, DE/AT/CH → de, ES/MX/AR/CO → es, FR/BE → fr, JP → ja; diğer tüm ülkeler → en (varsayılan).
- Export:
countryToNotificationLang(country)aynı eşlemeyi senkron döndürür (gerekirse başka modüllerde kullanılabilir).
Bildirim içeriği (başlık ve mesaj metni) oluşturulurken alıcı kullanıcının users.country değeri kullanılır; böylece eğitmen veya affiliate hangi bölgedeyse bildirim metni o dilde yazılır.
İçerik Metinleri (Başlık / Mesaj)
Section titled “İçerik Metinleri (Başlık / Mesaj)”Dosya: app/lib/notification-messages.ts
Desteklenen diller: tr, en, de, es, fr, ja. Şablonlar:
- Kurs onaylandı / reddedildi / silindi
- Kurs şikayetleri ve DMCA süreçleri (kursun inceleme altına alınması, pazardan kaldırılması)
- Yeni satış (eğitmen), affiliate komisyonu
- Ödeme onaylandı / reddedildi
- QnA: yeni soru (eğitmene), yeni yanıt (öğrenciye)
Bildirim oluşturan yerler (createNotification + getNotificationLangForUser):
- GraphQL (schema.ts): Kurs güncelleme (onay/red/silindi), soru/yanıt oluşturma.
- Stripe webhook: Tek kurs ve paket satışında eğitmen + affiliate bildirimleri.
- Admin payouts: Ödeme onay/red bildirimleri.
- Admin şikayet paneli:
admin.reports.$courseId.tsxiçinde, kurs şikayet/DMCA nedeniyle “İncelemeye al ve yayından kaldır” aksiyonu sonrası eğitmene kursun inceleme altına alındığını bildiren notification.
Arayüz Metinleri (Dropdown ve Bildirimler Sayfası)
Section titled “Arayüz Metinleri (Dropdown ve Bildirimler Sayfası)”Dosya: app/lib/notification-ui-strings.ts
- NOTIFICATION_UI_STRINGS: Her dil (tr, en, de, es, fr, ja) için:
dropdownTitle,pageTitle,pageDescription,markAllRead,viewAll,loading,emptyTitle,emptyDescription,viewButton,markAsRead,toastMarkAllSuccess. - getNotificationUiStrings(locale): Verilen locale için metinleri döndürür; tanımsız locale’de en kullanılır.
- getNotificationDateLocale(locale): Tarih formatı için
toLocaleDateStringlocale’i (tr-TR, de-DE, en-US vb.).
Hem header’daki bildirim dropdown’ı hem account/notifications sayfası bu metinleri kullanır; arayüz dil seçimi (i18n) kullanılmaz.
Dropdown (NotificationBell)
Section titled “Dropdown (NotificationBell)”Dosya: app/components/NotificationBell.tsx
- GraphQL’de myNotifications ve myNotificationLocale birlikte sorgulanır.
- myNotificationLocale: Mevcut kullanıcının
users.countrydeğerine göre dönen dil kodu (getNotificationLangForUser). - Dropdown başlığı, “Tümünü okundu işaretle”, “Tüm bildirimleri gör”, yükleme ve boş liste metinleri getNotificationUiStrings(notificationLocale) ile alınır.
- Tarih: getNotificationDateLocale(notificationLocale) ile formatlanır.
Bildirimler Sayfası (account/notifications)
Section titled “Bildirimler Sayfası (account/notifications)”Dosya: app/routes/account.notifications.tsx
- Loader: Kullanıcının bildirimleri çekilir; notificationLocale =
getNotificationLangForUser(db, session.user.id)ile hesaplanıp döndürülür. - Sayfa başlığı, açıklama, “Tümünü okundu işaretle”, boş durum, “Görüntüle”, “Okundu işaretle”, toast metni getNotificationUiStrings(notificationLocale) ile gösterilir.
- Tarih formatı getNotificationDateLocale(notificationLocale) ile uygulanır.
Böylece dropdown ve account/notifications aynı bölge dilini kullanır; bölge dilimizde yoksa İngilizce gösterilir.
GraphQL
Section titled “GraphQL”- myNotificationLocale:
Queryalanı; giriş yapmış kullanıcı için bildirim dilini (tr, en, de, es, fr, ja) döndürür. Kullanıcı yoksa"en". - myNotifications(limit): Kullanıcının bildirim listesi (id, type, title, message, link, isRead, createdAt).
- markNotificationRead(id), markAllNotificationsRead: Okundu işaretleme.
Özet Tablo
Section titled “Özet Tablo”| Konu | Açıklama |
|---|---|
| Dil kaynağı | users.country → getNotificationLangForUser; varsayılan en. |
| İçerik (başlık/mesaj) | notification-messages.ts; oluşturma anında alıcının bölge dili. |
| Arayüz (dropdown + sayfa) | notification-ui-strings.ts; getNotificationUiStrings(locale). |
| Dropdown | myNotificationLocale + myNotifications; NotificationBell. |
| account/notifications | Loader’da notificationLocale; aynı UI strings. |
| Tarih | getNotificationDateLocale(locale) ile toLocaleDateString. |
İlgili Dosyalar
Section titled “İlgili Dosyalar”app/lib/notifications.ts— getNotificationLangForUser, countryToNotificationLang, createNotification.app/lib/notification-messages.ts— Dil bazlı bildirim başlık/mesaj şablonları.app/lib/notification-ui-strings.ts— NOTIFICATION_UI_STRINGS, getNotificationUiStrings, getNotificationDateLocale.app/components/NotificationBell.tsx— Header dropdown; myNotificationLocale + myNotifications.app/routes/account.notifications.tsx— Bildirimler sayfası; loader’da notificationLocale.app/routes/admin.reports.$courseId.tsx— Kurs şikayetleri (DMCA) için kursu incelemeye alma ve eğitmene bildirim gönderme akışı.app/routes/admin.support.tsxveapp/routes/account.support.tsx— Destek masası ticket akışı;updateTicketStatusmutation’ı içinde ticket"resolved"veya"closed"olduğunda, ticket sahibinetype: "system"bir bildirim oluşturulur (link:/account/support, mesaj diligetNotificationLangForUserile kullanıcının ülkesine göre seçilir).app/graphql/schema.ts— myNotificationLocale, myNotifications, markNotificationRead, markAllNotificationsRead, destek ticket durum güncellemesi sırasında notification oluşturma mantığı.app/db/schema.ts— notifications tablosu (userId, type, title, message, link, isRead, createdAt).