Skip to content

Commit 0941c94

Browse files
feat[frontend](incidents): added custom assignation and expanded details drawer width
1 parent 0a3a054 commit 0941c94

9 files changed

Lines changed: 54 additions & 9 deletions

File tree

‎frontend/src/features/incidents/components/incident-assignee.tsx‎

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { useEffect, useRef, useState } from 'react'
2-
import { Check, ChevronDown, Loader2, UserCircle2, X } from 'lucide-react'
2+
import { Check, ChevronDown, Loader2, Plus, UserCircle2, X } from 'lucide-react'
33
import { useTranslation } from 'react-i18next'
44
import { useIncidentAssignment } from '../hooks/use-incident-assignment'
55
import type { Incident } from '../types/incident.types'
@@ -30,13 +30,22 @@ export function IncidentAssigneePicker({
3030
const { t } = useTranslation()
3131
const [open, setOpen] = useState(false)
3232
const [q, setQ] = useState('')
33+
const [custom, setCustom] = useState('')
3334
const ref = useRef<HTMLDivElement>(null)
3435
const current = incident.incidentAssignedTo
3536
const { users, busy, assign } = useIncidentAssignment(incident.id, open, () => {
3637
setOpen(false)
3738
onChanged()
3839
})
3940

41+
const customTrimmed = custom.trim()
42+
const canAssignCustom = customTrimmed.length > 0 && customTrimmed !== current
43+
const assignCustom = () => {
44+
if (!canAssignCustom) return
45+
void assign(customTrimmed)
46+
setCustom('')
47+
}
48+
4049
useEffect(() => {
4150
if (!open) return
4251
const onDoc = (e: MouseEvent) => ref.current && !ref.current.contains(e.target as Node) && setOpen(false)
@@ -95,6 +104,28 @@ export function IncidentAssigneePicker({
95104
</button>
96105
))}
97106
</div>
107+
<div className="mt-1 border-t border-border px-3 pb-2 pt-2">
108+
<div className="mb-1.5 text-[10px] font-medium uppercase tracking-wider text-muted-foreground">
109+
{t('incidents.assign.custom')}
110+
</div>
111+
<div className="flex items-center gap-1.5">
112+
<input
113+
value={custom}
114+
onChange={(e) => setCustom(e.target.value)}
115+
onKeyDown={(e) => e.key === 'Enter' && assignCustom()}
116+
placeholder={t('incidents.assign.customPlaceholder')}
117+
className="h-7 min-w-0 flex-1 rounded-md border border-input bg-background px-2 text-xs focus-visible:border-ring focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring"
118+
/>
119+
<button
120+
onClick={assignCustom}
121+
disabled={!canAssignCustom || busy}
122+
title={t('incidents.assign.custom')}
123+
className="flex h-7 w-7 shrink-0 items-center justify-center rounded-md bg-primary text-primary-foreground disabled:opacity-40"
124+
>
125+
<Plus size={14} />
126+
</button>
127+
</div>
128+
</div>
98129
</div>
99130
)}
100131
</div>

‎frontend/src/features/incidents/components/incident-drawer.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ export function IncidentDrawer({
3333
return (
3434
<div className="fixed inset-0 z-50 flex items-stretch justify-end bg-black/40 backdrop-blur-sm" onClick={onClose}>
3535
<div
36-
className="flex w-full max-w-[760px] flex-col overflow-hidden border-l border-border bg-card shadow-xl"
36+
className="flex w-full max-w-[46em] flex-col overflow-hidden border-l border-border bg-card shadow-xl"
3737
onClick={(e) => e.stopPropagation()}
3838
>
3939
<header className="border-b border-border px-6 py-4">

‎frontend/src/shared/i18n/locales/de.json‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4132,7 +4132,9 @@
41324132
"noUsers": "Keine Benutzer",
41334133
"assigned": "Zugewiesen an {{user}}",
41344134
"unassigned": "Zuweisung aufgehoben",
4135-
"error": "Zuweisung konnte nicht geändert werden"
4135+
"error": "Zuweisung konnte nicht geändert werden",
4136+
"custom": "Benutzerdefiniert zuweisen",
4137+
"customPlaceholder": "Login eingeben…"
41364138
}
41374139
},
41384140
"alertingRules": {

‎frontend/src/shared/i18n/locales/en.json‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4489,7 +4489,9 @@
44894489
"noUsers": "No users",
44904490
"assigned": "Assigned to {{user}}",
44914491
"unassigned": "Incident unassigned",
4492-
"error": "Could not change the assignee"
4492+
"error": "Could not change the assignee",
4493+
"custom": "Assign custom",
4494+
"customPlaceholder": "Type a login…"
44934495
}
44944496
},
44954497
"parsingFilters": {

‎frontend/src/shared/i18n/locales/es.json‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4241,7 +4241,9 @@
42414241
"noUsers": "Sin usuarios",
42424242
"assigned": "Asignado a {{user}}",
42434243
"unassigned": "Incidente sin asignar",
4244-
"error": "No se pudo cambiar el asignado"
4244+
"error": "No se pudo cambiar el asignado",
4245+
"custom": "Asignar personalizado",
4246+
"customPlaceholder": "Escribe un usuario…"
42454247
}
42464248
},
42474249
"parsingFilters": {

‎frontend/src/shared/i18n/locales/fr.json‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4132,7 +4132,9 @@
41324132
"noUsers": "Aucun utilisateur",
41334133
"assigned": "Assigné à {{user}}",
41344134
"unassigned": "Incident désassigné",
4135-
"error": "Impossible de changer l’assigné"
4135+
"error": "Impossible de changer l’assigné",
4136+
"custom": "Assigner personnalisé",
4137+
"customPlaceholder": "Saisir un identifiant…"
41364138
}
41374139
},
41384140
"alertingRules": {

‎frontend/src/shared/i18n/locales/it.json‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4132,7 +4132,9 @@
41324132
"noUsers": "Nessun utente",
41334133
"assigned": "Assegnato a {{user}}",
41344134
"unassigned": "Incidente non assegnato",
4135-
"error": "Impossibile cambiare l’assegnatario"
4135+
"error": "Impossibile cambiare l’assegnatario",
4136+
"custom": "Assegna personalizzato",
4137+
"customPlaceholder": "Inserisci un login…"
41364138
}
41374139
},
41384140
"alertingRules": {

‎frontend/src/shared/i18n/locales/pt.json‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4241,7 +4241,9 @@
42414241
"noUsers": "Sem usuários",
42424242
"assigned": "Atribuído a {{user}}",
42434243
"unassigned": "Incidente sem atribuição",
4244-
"error": "Não foi possível alterar o responsável"
4244+
"error": "Não foi possível alterar o responsável",
4245+
"custom": "Atribuir personalizado",
4246+
"customPlaceholder": "Digite um login…"
42454247
}
42464248
},
42474249
"parsingFilters": {

‎frontend/src/shared/i18n/locales/ru.json‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3942,7 +3942,9 @@
39423942
"noUsers": "Нет пользователей",
39433943
"assigned": "Назначено {{user}}",
39443944
"unassigned": "Назначение снято",
3945-
"error": "Не удалось изменить ответственного"
3945+
"error": "Не удалось изменить ответственного",
3946+
"custom": "Назначить произвольно",
3947+
"customPlaceholder": "Введите логин…"
39463948
}
39473949
},
39483950
"alertingRules": {

0 commit comments

Comments
 (0)