Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitd97dd82

Browse files
committed
Apply a few Michaels suggestions
1 parent341f550 commitd97dd82

File tree

3 files changed

+24
-18
lines changed

3 files changed

+24
-18
lines changed

‎site/src/api/queries/notifications.ts

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ export const updateUserNotificationPreferences = (
3838
id,
3939
disabled,
4040
updated_at:newDate().toISOString(),
41-
})asNotificationPreference,
41+
})satisfiesNotificationPreference,
4242
),
4343
);
4444
},
@@ -65,7 +65,7 @@ export const systemNotificationTemplates = () => {
6565
exportfunctionselectTemplatesByGroup(
6666
data:NotificationTemplate[],
6767
):Record<string,NotificationTemplate[]>{
68-
returndata.reduce(
68+
constgrouped=data.reduce(
6969
(acc,tpl)=>{
7070
if(!acc[tpl.group]){
7171
acc[tpl.group]=[];
@@ -75,6 +75,20 @@ export function selectTemplatesByGroup(
7575
},
7676
{}asRecord<string,NotificationTemplate[]>,
7777
);
78+
79+
// Sort templates within each group
80+
for(constgroupingrouped){
81+
grouped[group].sort((a,b)=>a.name.localeCompare(b.name));
82+
}
83+
84+
// Sort groups by name
85+
constsortedGroups=Object.keys(grouped).sort((a,b)=>a.localeCompare(b));
86+
constsortedGrouped:Record<string,NotificationTemplate[]>={};
87+
for(constgroupofsortedGroups){
88+
sortedGrouped[group]=grouped[group];
89+
}
90+
91+
returnsortedGrouped;
7892
}
7993

8094
exportconstnotificationDispatchMethodsKey=[

‎site/src/pages/DeploySettingsPage/NotificationsPage/NotificationsPage.tsx

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ const EventsView: FC<EventsViewProps> = ({
190190
deploymentValues,
191191
})=>{
192192
return(
193-
<Stackspacing={3}>
193+
<Stackspacing={4}>
194194
{availableMethods.includes("smtp")&&
195195
deploymentValues.notifications?.webhook.endpoint===""&&(
196196
<Alertseverity="warning">
@@ -218,8 +218,9 @@ const EventsView: FC<EventsViewProps> = ({
218218
<ListItemTextcss={styles.listItemText}primary={group}/>
219219
</ListItem>
220220

221-
{templates.map((tpl)=>{
221+
{templates.map((tpl,i)=>{
222222
constvalue=castNotificationMethod(tpl.method||defaultMethod);
223+
constisLastItem=i===templates.length-1;
223224

224225
return(
225226
<Fragmentkey={tpl.id}>
@@ -234,7 +235,7 @@ const EventsView: FC<EventsViewProps> = ({
234235
value={value}
235236
/>
236237
</ListItem>
237-
<Dividercss={styles.divider}/>
238+
{!isLastItem&&<Divider/>}
238239
</Fragment>
239240
);
240241
})}
@@ -281,9 +282,4 @@ const styles = {
281282
fontSize:"inherit",
282283
},
283284
}),
284-
divider:{
285-
"&:last-child":{
286-
display:"none",
287-
},
288-
},
289285
}asRecord<string,Interpolation<Theme>>;

‎site/src/pages/UserSettingsPage/NotificationsPage/NotificationsPage.tsx

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ export const NotificationsPage: FC = () => {
102102
layout="fluid"
103103
>
104104
{ready ?(
105-
<Stackspacing={3}>
105+
<Stackspacing={4}>
106106
{Object.entries(templatesByGroup.data).map(([group,templates])=>{
107107
constallDisabled=templates.some((tpl)=>{
108108
returndisabledPreferences.data[tpl.id]===true;
@@ -138,12 +138,13 @@ export const NotificationsPage: FC = () => {
138138
}}
139139
/>
140140
</ListItem>
141-
{templates.map((tmpl)=>{
141+
{templates.map((tmpl,i)=>{
142142
constmethod=castNotificationMethod(
143143
tmpl.method||dispatchMethods.data.default,
144144
);
145145
constIcon=methodIcons[method];
146146
constlabel=methodLabels[method];
147+
constisLastItem=i===templates.length-1;
147148

148149
return(
149150
<Fragmentkey={tmpl.id}>
@@ -177,7 +178,7 @@ export const NotificationsPage: FC = () => {
177178
</Tooltip>
178179
</ListItemIcon>
179180
</ListItem>
180-
<Dividercss={styles.divider}/>
181+
{!isLastItem&&<Divider/>}
181182
</Fragment>
182183
);
183184
})}
@@ -230,9 +231,4 @@ const styles = {
230231
fontSize:"inherit",
231232
},
232233
}),
233-
divider:{
234-
"&:last-child":{
235-
display:"none",
236-
},
237-
},
238234
}asRecord<string,Interpolation<Theme>>;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp