fix: discard button in sticky save bar instead of browser confirm
This commit is contained in:
@@ -28,7 +28,7 @@ const TIMEZONES = [
|
||||
{ value: 'Australia/Sydney', label: 'Australia/Sydney (AEST)' },
|
||||
]
|
||||
|
||||
export default function SiteGeneralTab({ siteId, onDirtyChange }: { siteId: string; onDirtyChange?: (dirty: boolean) => void }) {
|
||||
export default function SiteGeneralTab({ siteId, onDirtyChange, hasPendingAction, onDiscard }: { siteId: string; onDirtyChange?: (dirty: boolean) => void; hasPendingAction?: boolean; onDiscard?: () => void }) {
|
||||
const router = useRouter()
|
||||
const { user } = useAuth()
|
||||
const { closeUnifiedSettings: closeSettings } = useUnifiedSettings()
|
||||
@@ -180,10 +180,17 @@ export default function SiteGeneralTab({ siteId, onDirtyChange }: { siteId: stri
|
||||
{/* Sticky save bar */}
|
||||
{isDirty && (
|
||||
<div className="sticky bottom-0 -mx-6 -mb-6 px-6 py-3 bg-neutral-900/95 backdrop-blur-sm border-t border-neutral-800 flex items-center justify-between">
|
||||
<span className="text-xs text-neutral-400">Unsaved changes</span>
|
||||
<Button onClick={handleSave} variant="primary" disabled={saving} className="text-sm">
|
||||
{saving ? 'Saving...' : 'Save Changes'}
|
||||
</Button>
|
||||
<span className="text-xs text-neutral-400">{hasPendingAction ? 'Save or discard to continue' : 'Unsaved changes'}</span>
|
||||
<div className="flex items-center gap-2">
|
||||
{hasPendingAction && (
|
||||
<button onClick={onDiscard} className="px-3 py-1.5 text-xs font-medium text-neutral-400 hover:text-white transition-colors">
|
||||
Discard
|
||||
</button>
|
||||
)}
|
||||
<Button onClick={handleSave} variant="primary" disabled={saving} className="text-sm">
|
||||
{saving ? 'Saving...' : 'Save Changes'}
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user