1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2025-02-20 14:54:15 +01:00

(bug) fix default tab in notif center and some documentation

This commit is contained in:
Karen 2023-02-03 16:36:41 +01:00 committed by Sylvain
parent fb0b32e0d2
commit f7ed347fcb
4 changed files with 21 additions and 10 deletions

View File

@ -34,16 +34,20 @@ const NotificationsCategory: React.FC<NotificationsCategoryProps> = ({ onError,
};
return (
<div className="notifications-category">
<h2 className="category-name">{`${t(`app.logged.notifications_category.${categoryName}`)}, ${t('app.logged.notifications_category.notify_me_when')}`}</h2>
<div className="category-content">
<div className="category-actions">
<FabButton className="category-action category-action-left" onClick={enableAll}>{t('app.logged.notifications_category.enable_all')}</FabButton>
<FabButton className="category-action" onClick={disableAll}>{t('app.logged.notifications_category.disable_all')}</FabButton>
<>
{(preferences.length > 0) &&
<div className="notifications-category">
<h2 className="category-name">{`${t(`app.logged.notifications_category.${categoryName}`)}, ${t('app.logged.notifications_category.notify_me_when')}`}</h2>
<div className="category-content">
<div className="category-actions">
<FabButton className="category-action category-action-left" onClick={enableAll}>{t('app.logged.notifications_category.enable_all')}</FabButton>
<FabButton className="category-action" onClick={disableAll}>{t('app.logged.notifications_category.disable_all')}</FabButton>
</div>
{preferences.map(preference => <NotificationForm key={preference.notification_type} preference={preference} onError={onError}/>)}
</div>
{preferences.map(preference => <NotificationForm key={preference.notification_type} preference={preference} onError={onError}/>)}
</div>
</div>
}
</>
);
};

View File

@ -30,7 +30,7 @@ export const NotificationsCenter: React.FC<NotificationsCenterProps> = ({ onErro
return (
<>
{role === 'admin' && <FabTabs defaultTab='notifications_settings' tabs={[
{role === 'admin' && <FabTabs defaultTab='notifications-list' tabs={[
{
id: 'notifications_settings',
title: t('app.logged.notifications_center.notifications_settings'),

View File

@ -16,7 +16,8 @@ export const NotificationCategoryNames = [
'shop',
'projects',
'accountings',
'trainings'
'trainings',
'app_management'
] as const;
export type NotificationCategoryName = typeof NotificationCategoryNames[number];

View File

@ -1,6 +1,12 @@
# frozen_string_literal: true
# NotificationType defines the different types of Notification.
# When recording a new notification type in db, you might also want to add it in:
# test/fixtures/notification_types.yml
# app/frontend/src/javascript/models/notification-type.ts
# config/locales/app.logged.en.yml
# If you change the name of a category, or create a new one, please add it in:
# app/frontend/src/javascript/models/notification-preference.ts
class NotificationType < ApplicationRecord
has_many :notifications, dependent: :destroy
has_many :notification_preferences, dependent: :destroy