@@ -9,8 +9,10 @@ const props = withDefaults(
99 defineProps <{
1010 packageName: string
1111 version? : string
12+ /** When true, the package or version is already deprecated; form is hidden and state cannot be changed. */
13+ isAlreadyDeprecated? : boolean
1214 }>(),
13- { version: ' ' },
15+ { version: ' ' , isAlreadyDeprecated: false },
1416)
1517
1618const { t } = useI18n ()
@@ -32,6 +34,7 @@ const modalTitle = computed(() =>
3234)
3335
3436async function handleDeprecate() {
37+ if (props .isAlreadyDeprecated ) return
3538 const message = deprecateMessage .value .trim ()
3639 if (! isConnected .value ) return
3740
@@ -119,8 +122,32 @@ defineExpose({ open, close })
119122
120123<template >
121124 <Modal ref =" dialogRef" :modal-title =" modalTitle" id =" deprecate-package-modal" class =" max-w-md" >
125+ <!-- Already deprecated: read-only, no form -->
126+ <div v-if =" isAlreadyDeprecated" class =" space-y-4" >
127+ <div
128+ class =" flex items-center gap-3 p-4 bg-amber-500/10 border border-amber-500/20 rounded-lg"
129+ >
130+ <span class =" i-carbon-warning-alt text-amber-500 w-6 h-6" aria-hidden =" true" />
131+ <div >
132+ <p class =" font-mono text-sm text-fg" >
133+ {{ $t('package.deprecation.modal.already_deprecated') }}
134+ </p >
135+ <p class =" text-xs text-fg-muted" >
136+ {{ $t('package.deprecation.modal.already_deprecated_detail') }}
137+ </p >
138+ </div >
139+ </div >
140+ <button
141+ type =" button"
142+ class =" w-full px-4 py-2 font-mono text-sm text-fg-muted bg-bg-subtle border border-border rounded-md transition-colors duration-200 hover:text-fg hover:border-border-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-fg/50"
143+ @click =" close"
144+ >
145+ {{ $t('common.close') }}
146+ </button >
147+ </div >
148+
122149 <!-- Success state -->
123- <div v-if =" deprecateSuccess" class =" space-y-4" >
150+ <div v-else- if =" deprecateSuccess" class =" space-y-4" >
124151 <div
125152 class =" flex items-center gap-3 p-4 bg-green-500/10 border border-green-500/20 rounded-lg"
126153 >
@@ -141,7 +168,7 @@ defineExpose({ open, close })
141168 </button >
142169 </div >
143170
144- <!-- Form (only shown when connected; parent only opens modal when isConnected ) -->
171+ <!-- Form (only shown when not already deprecated and connected ) -->
145172 <div v-else class =" space-y-4" >
146173 <div >
147174 <label for =" deprecate-message" class =" block text-sm font-medium text-fg mb-1" >
0 commit comments