@@ -10,10 +10,15 @@ import {
1010 DialogTitle ,
1111} from "@ace/ui" ;
1212
13- /** Removing only forgets the folder, so a person may turn the question off. */
14- export function RemoveProject ( { name, path, onRemove, onCancel } : {
13+ /**
14+ * Removing only forgets the folder, so a person may turn the question off. The host refuses while
15+ * the project has channels, so then this says how to delete them instead of offering to remove.
16+ */
17+ export function RemoveProject ( { name, path, channels, onRemove, onCancel } : {
1518 name : string ;
1619 path : string ;
20+ /** This host's channels in it, counting archived ones. */
21+ channels : number ;
1722 onRemove : ( ask : boolean ) => Promise < void > ;
1823 onCancel : ( ) => void ;
1924} ) {
@@ -34,35 +39,54 @@ export function RemoveProject({ name, path, onRemove, onCancel }: {
3439 < Dialog open onOpenChange = { next => ( next || busy ? undefined : onCancel ( ) ) } >
3540 < DialogContent className = "gap-3 sm:max-w-80" showCloseButton = { false } >
3641 < DialogHeader >
37- < DialogTitle className = "break-all" > Remove { name } ?</ DialogTitle >
42+ < DialogTitle className = "break-all" >
43+ { channels
44+ ? `${ name } still has ${ channels === 1 ? "a channel" : "channels" } `
45+ : `Remove ${ name } ?` }
46+ </ DialogTitle >
3847 < DialogDescription className = "break-words" >
39- Ace forgets the project. Its files and lanes stay in{ " " }
40- { path } , and opening the folder adds it back.
48+ { channels
49+ ? `It has ${
50+ channels === 1 ? "a channel" : `${ channels } channels`
51+ } , counting archived ones. Archive ${
52+ channels === 1 ? "it" : "each"
53+ } from its ⋯ menu, delete it from the Archived group, then remove the project.`
54+ : `Ace forgets the project. Its files and lanes stay in ${ path } , and opening the folder adds it back.` }
4155 </ DialogDescription >
4256 </ DialogHeader >
43- < label htmlFor = { id } className = "flex items-center gap-2 text-xs text-muted-foreground" >
44- < input
45- id = { id }
46- type = "checkbox"
47- checked = { skip }
48- disabled = { busy }
49- onChange = { ( event ) => setSkip ( event . target . checked ) }
50- />
51- Don't ask again
52- </ label >
53- < DialogFooter >
54- < Button type = "button" variant = "outline" disabled = { busy } onClick = { onCancel } >
55- Cancel
56- </ Button >
57- < Button
58- type = "button"
59- variant = "destructive"
60- disabled = { busy }
61- onClick = { ( ) => void confirm ( ) }
62- >
63- { busy ? "Removing…" : "Remove project" }
64- </ Button >
65- </ DialogFooter >
57+ { channels > 0
58+ ? (
59+ < DialogFooter >
60+ < Button type = "button" variant = "outline" onClick = { onCancel } > OK</ Button >
61+ </ DialogFooter >
62+ )
63+ : (
64+ < >
65+ < label htmlFor = { id } className = "flex items-center gap-2 text-xs text-muted-foreground" >
66+ < input
67+ id = { id }
68+ type = "checkbox"
69+ checked = { skip }
70+ disabled = { busy }
71+ onChange = { ( event ) => setSkip ( event . target . checked ) }
72+ />
73+ Don't ask again
74+ </ label >
75+ < DialogFooter >
76+ < Button type = "button" variant = "outline" disabled = { busy } onClick = { onCancel } >
77+ Cancel
78+ </ Button >
79+ < Button
80+ type = "button"
81+ variant = "destructive"
82+ disabled = { busy }
83+ onClick = { ( ) => void confirm ( ) }
84+ >
85+ { busy ? "Removing…" : "Remove project" }
86+ </ Button >
87+ </ DialogFooter >
88+ </ >
89+ ) }
6690 </ DialogContent >
6791 </ Dialog >
6892 ) ;
0 commit comments