refactor: adopt shared Button component in 18 modal components
Replace raw <button> elements with <Button> from ui/Button.tsx: - Primary buttons (bg-gradient-brand) → <Button variant="primary"> - Secondary buttons (border-border) → <Button variant="secondary"> - Ghost buttons → <Button variant="ghost"> - Loading states use loading prop instead of manual Loader2 spinner Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
import { useState } from 'react'
|
import { useState } from 'react'
|
||||||
import { cn } from '@/lib/utils'
|
import { cn } from '@/lib/utils'
|
||||||
import { Modal } from '@/components/common/Modal'
|
import { Modal } from '@/components/common/Modal'
|
||||||
|
import { Button } from '@/components/ui/Button'
|
||||||
|
|
||||||
interface CreateCategoryModalProps {
|
interface CreateCategoryModalProps {
|
||||||
isOpen: boolean
|
isOpen: boolean
|
||||||
@@ -62,28 +63,22 @@ export function CreateCategoryModal({
|
|||||||
size="sm"
|
size="sm"
|
||||||
footer={
|
footer={
|
||||||
<div className="flex justify-end gap-2">
|
<div className="flex justify-end gap-2">
|
||||||
<button
|
<Button
|
||||||
type="button"
|
type="button"
|
||||||
|
variant="secondary"
|
||||||
onClick={handleClose}
|
onClick={handleClose}
|
||||||
disabled={isSaving}
|
disabled={isSaving}
|
||||||
className={cn(
|
|
||||||
'rounded-md border border-border px-4 py-2 text-sm font-medium text-muted-foreground',
|
|
||||||
'hover:bg-accent hover:text-foreground disabled:opacity-50'
|
|
||||||
)}
|
|
||||||
>
|
>
|
||||||
Cancel
|
Cancel
|
||||||
</button>
|
</Button>
|
||||||
<button
|
<Button
|
||||||
type="submit"
|
type="submit"
|
||||||
form="create-category-form"
|
form="create-category-form"
|
||||||
disabled={isSaving || !name.trim()}
|
disabled={!name.trim()}
|
||||||
className={cn(
|
loading={isSaving}
|
||||||
'rounded-md bg-gradient-brand text-white shadow-lg shadow-primary/20 px-4 py-2 text-sm font-medium',
|
|
||||||
'hover:opacity-90 disabled:opacity-50'
|
|
||||||
)}
|
|
||||||
>
|
>
|
||||||
{isSaving ? 'Creating...' : 'Create Category'}
|
Create Category
|
||||||
</button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import { useState } from 'react'
|
|||||||
import { cn } from '@/lib/utils'
|
import { cn } from '@/lib/utils'
|
||||||
import type { StepCategoryListItem } from '@/types'
|
import type { StepCategoryListItem } from '@/types'
|
||||||
import { Modal } from '@/components/common/Modal'
|
import { Modal } from '@/components/common/Modal'
|
||||||
|
import { Button } from '@/components/ui/Button'
|
||||||
|
|
||||||
interface EditCategoryModalProps {
|
interface EditCategoryModalProps {
|
||||||
isOpen: boolean
|
isOpen: boolean
|
||||||
@@ -74,28 +75,22 @@ export function EditCategoryModal({
|
|||||||
size="sm"
|
size="sm"
|
||||||
footer={
|
footer={
|
||||||
<div className="flex justify-end gap-2">
|
<div className="flex justify-end gap-2">
|
||||||
<button
|
<Button
|
||||||
type="button"
|
type="button"
|
||||||
|
variant="secondary"
|
||||||
onClick={handleClose}
|
onClick={handleClose}
|
||||||
disabled={isSaving}
|
disabled={isSaving}
|
||||||
className={cn(
|
|
||||||
'rounded-md border border-border px-4 py-2 text-sm font-medium text-muted-foreground',
|
|
||||||
'hover:bg-accent hover:text-foreground disabled:opacity-50'
|
|
||||||
)}
|
|
||||||
>
|
>
|
||||||
Cancel
|
Cancel
|
||||||
</button>
|
</Button>
|
||||||
<button
|
<Button
|
||||||
type="submit"
|
type="submit"
|
||||||
form="edit-category-form"
|
form="edit-category-form"
|
||||||
disabled={isSaving || !name.trim()}
|
disabled={!name.trim()}
|
||||||
className={cn(
|
loading={isSaving}
|
||||||
'rounded-md bg-gradient-brand text-white shadow-lg shadow-primary/20 px-4 py-2 text-sm font-medium',
|
|
||||||
'hover:opacity-90 disabled:opacity-50'
|
|
||||||
)}
|
|
||||||
>
|
>
|
||||||
{isSaving ? 'Saving...' : 'Save Changes'}
|
Save Changes
|
||||||
</button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import { useState, useEffect } from 'react'
|
|||||||
import { Download, X } from 'lucide-react'
|
import { Download, X } from 'lucide-react'
|
||||||
import { flowTransferApi } from '@/api/flowTransfer'
|
import { flowTransferApi } from '@/api/flowTransfer'
|
||||||
import { toast } from '@/lib/toast'
|
import { toast } from '@/lib/toast'
|
||||||
|
import { Button } from '@/components/ui/Button'
|
||||||
|
|
||||||
interface ExportFlowModalProps {
|
interface ExportFlowModalProps {
|
||||||
treeId: string
|
treeId: string
|
||||||
@@ -79,20 +80,16 @@ export function ExportFlowModal({ treeId, treeName, onClose }: ExportFlowModalPr
|
|||||||
|
|
||||||
{/* Footer */}
|
{/* Footer */}
|
||||||
<div className="flex justify-end gap-2 border-t border-border px-5 py-3">
|
<div className="flex justify-end gap-2 border-t border-border px-5 py-3">
|
||||||
<button
|
<Button variant="secondary" onClick={onClose}>
|
||||||
onClick={onClose}
|
|
||||||
className="rounded-lg border border-border px-4 py-2 text-sm text-muted-foreground hover:bg-accent hover:text-foreground"
|
|
||||||
>
|
|
||||||
Cancel
|
Cancel
|
||||||
</button>
|
</Button>
|
||||||
<button
|
<Button
|
||||||
onClick={handleExport}
|
onClick={handleExport}
|
||||||
disabled={isExporting}
|
loading={isExporting}
|
||||||
className="bg-gradient-brand flex items-center gap-2 rounded-lg px-4 py-2 text-sm font-medium text-white shadow-lg shadow-primary/20 hover:opacity-90 disabled:opacity-40 disabled:cursor-not-allowed"
|
|
||||||
>
|
>
|
||||||
<Download className="h-4 w-4" />
|
<Download className="h-4 w-4" />
|
||||||
{isExporting ? 'Exporting…' : 'Download .rfflow'}
|
Download .rfflow
|
||||||
</button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import { foldersApi } from '@/api/folders'
|
|||||||
import type { FolderListItem, FolderCreate, FolderUpdate } from '@/types'
|
import type { FolderListItem, FolderCreate, FolderUpdate } from '@/types'
|
||||||
import { cn } from '@/lib/utils'
|
import { cn } from '@/lib/utils'
|
||||||
import { toast } from '@/lib/toast'
|
import { toast } from '@/lib/toast'
|
||||||
|
import { Button } from '@/components/ui/Button'
|
||||||
|
|
||||||
// Predefined color options
|
// Predefined color options
|
||||||
const FOLDER_COLORS = [
|
const FOLDER_COLORS = [
|
||||||
@@ -259,24 +260,19 @@ export function FolderEditModal({
|
|||||||
|
|
||||||
{/* Actions */}
|
{/* Actions */}
|
||||||
<div className="flex justify-end gap-3">
|
<div className="flex justify-end gap-3">
|
||||||
<button
|
<Button
|
||||||
type="button"
|
type="button"
|
||||||
|
variant="secondary"
|
||||||
onClick={onClose}
|
onClick={onClose}
|
||||||
className={cn('rounded-md border border-border px-4 py-2 text-sm text-muted-foreground', 'hover:bg-accent hover:text-foreground')}
|
|
||||||
>
|
>
|
||||||
Cancel
|
Cancel
|
||||||
</button>
|
</Button>
|
||||||
<button
|
<Button
|
||||||
type="submit"
|
type="submit"
|
||||||
disabled={isSubmitting}
|
loading={isSubmitting}
|
||||||
className={cn(
|
|
||||||
'rounded-md bg-gradient-brand px-4 py-2 text-sm font-medium text-white shadow-lg shadow-primary/20',
|
|
||||||
'hover:opacity-90',
|
|
||||||
'disabled:opacity-50'
|
|
||||||
)}
|
|
||||||
>
|
>
|
||||||
{isSubmitting ? 'Saving...' : isEditMode ? 'Save Changes' : 'Create Folder'}
|
{isEditMode ? 'Save Changes' : 'Create Folder'}
|
||||||
</button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import { treesApi } from '@/api/trees'
|
|||||||
import { toast } from '@/lib/toast'
|
import { toast } from '@/lib/toast'
|
||||||
import { cn } from '@/lib/utils'
|
import { cn } from '@/lib/utils'
|
||||||
import { useNavigate } from 'react-router-dom'
|
import { useNavigate } from 'react-router-dom'
|
||||||
|
import { Button } from '@/components/ui/Button'
|
||||||
|
|
||||||
interface ForkModalProps {
|
interface ForkModalProps {
|
||||||
treeId: string
|
treeId: string
|
||||||
@@ -116,20 +117,20 @@ export function ForkModal({ treeId, treeName, onClose }: ForkModalProps) {
|
|||||||
|
|
||||||
{/* Footer */}
|
{/* Footer */}
|
||||||
<div className="flex justify-end gap-2 pt-1">
|
<div className="flex justify-end gap-2 pt-1">
|
||||||
<button
|
<Button
|
||||||
type="button"
|
type="button"
|
||||||
|
variant="secondary"
|
||||||
onClick={onClose}
|
onClick={onClose}
|
||||||
className="rounded-lg border border-border px-4 py-2 text-sm text-muted-foreground hover:bg-accent hover:text-foreground"
|
|
||||||
>
|
>
|
||||||
Cancel
|
Cancel
|
||||||
</button>
|
</Button>
|
||||||
<button
|
<Button
|
||||||
type="submit"
|
type="submit"
|
||||||
disabled={isSubmitting || !name.trim()}
|
disabled={!name.trim()}
|
||||||
className="bg-gradient-brand flex items-center gap-2 rounded-lg px-4 py-2 text-sm font-medium text-white shadow-lg shadow-primary/20 hover:opacity-90 disabled:opacity-40 disabled:cursor-not-allowed"
|
loading={isSubmitting}
|
||||||
>
|
>
|
||||||
{isSubmitting ? 'Forking…' : 'Fork Flow'}
|
Fork Flow
|
||||||
</button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import { toast } from '@/lib/toast'
|
|||||||
import { cn } from '@/lib/utils'
|
import { cn } from '@/lib/utils'
|
||||||
import { useNavigate } from 'react-router-dom'
|
import { useNavigate } from 'react-router-dom'
|
||||||
import { getTreeEditorPath } from '@/lib/routing'
|
import { getTreeEditorPath } from '@/lib/routing'
|
||||||
|
import { Button } from '@/components/ui/Button'
|
||||||
|
|
||||||
interface ImportFlowModalProps {
|
interface ImportFlowModalProps {
|
||||||
onClose: () => void
|
onClose: () => void
|
||||||
@@ -227,28 +228,26 @@ export function ImportFlowModal({ onClose }: ImportFlowModalProps) {
|
|||||||
{/* Footer */}
|
{/* Footer */}
|
||||||
<div className="flex justify-end gap-2 border-t border-border px-5 py-3">
|
<div className="flex justify-end gap-2 border-t border-border px-5 py-3">
|
||||||
{step === 'preview' && (
|
{step === 'preview' && (
|
||||||
<button
|
<Button
|
||||||
|
variant="secondary"
|
||||||
onClick={() => { setStep('pick'); setParsed(null); setParseError(null) }}
|
onClick={() => { setStep('pick'); setParsed(null); setParseError(null) }}
|
||||||
className="mr-auto rounded-lg border border-border px-3 py-2 text-sm text-muted-foreground hover:bg-accent hover:text-foreground"
|
className="mr-auto"
|
||||||
>
|
>
|
||||||
Back
|
Back
|
||||||
</button>
|
</Button>
|
||||||
)}
|
)}
|
||||||
<button
|
<Button variant="secondary" onClick={onClose}>
|
||||||
onClick={onClose}
|
|
||||||
className="rounded-lg border border-border px-4 py-2 text-sm text-muted-foreground hover:bg-accent hover:text-foreground"
|
|
||||||
>
|
|
||||||
Cancel
|
Cancel
|
||||||
</button>
|
</Button>
|
||||||
{step === 'preview' && (
|
{step === 'preview' && (
|
||||||
<button
|
<Button
|
||||||
onClick={handleImport}
|
onClick={handleImport}
|
||||||
disabled={isImporting || !nameOverride.trim()}
|
disabled={!nameOverride.trim()}
|
||||||
className="bg-gradient-brand flex items-center gap-2 rounded-lg px-4 py-2 text-sm font-medium text-white shadow-lg shadow-primary/20 hover:opacity-90 disabled:opacity-40 disabled:cursor-not-allowed"
|
loading={isImporting}
|
||||||
>
|
>
|
||||||
<FileUp className="h-4 w-4" />
|
<FileUp className="h-4 w-4" />
|
||||||
{isImporting ? 'Importing…' : 'Import as Draft'}
|
Import as Draft
|
||||||
</button>
|
</Button>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import type { TreeListItem, TreeShare, TreeVisibility } from '@/types'
|
|||||||
import { treesApi } from '@/api/trees'
|
import { treesApi } from '@/api/trees'
|
||||||
import { cn } from '@/lib/utils'
|
import { cn } from '@/lib/utils'
|
||||||
import { toast } from '@/lib/toast'
|
import { toast } from '@/lib/toast'
|
||||||
|
import { Button } from '@/components/ui/Button'
|
||||||
|
|
||||||
interface ShareTreeModalProps {
|
interface ShareTreeModalProps {
|
||||||
tree: TreeListItem
|
tree: TreeListItem
|
||||||
@@ -201,16 +202,13 @@ export function ShareTreeModal({ tree, isOpen, onClose }: ShareTreeModalProps) {
|
|||||||
|
|
||||||
{/* Generate Button */}
|
{/* Generate Button */}
|
||||||
{!activeShare && (
|
{!activeShare && (
|
||||||
<button
|
<Button
|
||||||
onClick={handleGenerateLink}
|
onClick={handleGenerateLink}
|
||||||
disabled={isGenerating}
|
loading={isGenerating}
|
||||||
className={cn(
|
className="w-full"
|
||||||
'w-full rounded-md bg-gradient-brand px-4 py-2 text-sm font-medium text-white shadow-lg shadow-primary/20',
|
|
||||||
'hover:opacity-90 disabled:opacity-50 disabled:cursor-not-allowed'
|
|
||||||
)}
|
|
||||||
>
|
>
|
||||||
{isGenerating ? 'Generating...' : 'Generate Share Link'}
|
Generate Share Link
|
||||||
</button>
|
</Button>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{/* Active Share Link */}
|
{/* Active Share Link */}
|
||||||
@@ -263,15 +261,9 @@ export function ShareTreeModal({ tree, isOpen, onClose }: ShareTreeModalProps) {
|
|||||||
|
|
||||||
{/* Footer */}
|
{/* Footer */}
|
||||||
<div className="flex justify-end gap-3 border-t border-border px-6 py-4">
|
<div className="flex justify-end gap-3 border-t border-border px-6 py-4">
|
||||||
<button
|
<Button variant="secondary" onClick={onClose}>
|
||||||
onClick={onClose}
|
|
||||||
className={cn(
|
|
||||||
'rounded-md border border-border px-4 py-2 text-sm font-medium text-muted-foreground',
|
|
||||||
'hover:bg-accent hover:text-foreground'
|
|
||||||
)}
|
|
||||||
>
|
|
||||||
Close
|
Close
|
||||||
</button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import { useState } from 'react'
|
|||||||
import type { IntakeFormField } from '@/types'
|
import type { IntakeFormField } from '@/types'
|
||||||
import { PasswordInput } from '@/components/common/PasswordInput'
|
import { PasswordInput } from '@/components/common/PasswordInput'
|
||||||
import { cn } from '@/lib/utils'
|
import { cn } from '@/lib/utils'
|
||||||
|
import { Button } from '@/components/ui/Button'
|
||||||
|
|
||||||
interface IntakeFormModalProps {
|
interface IntakeFormModalProps {
|
||||||
isOpen: boolean
|
isOpen: boolean
|
||||||
@@ -240,19 +241,16 @@ export function IntakeFormModal({ isOpen, fields, treeName, onSubmit, onCancel }
|
|||||||
|
|
||||||
{/* Footer */}
|
{/* Footer */}
|
||||||
<div className="flex items-center justify-end gap-2 border-t border-border px-6 py-4">
|
<div className="flex items-center justify-end gap-2 border-t border-border px-6 py-4">
|
||||||
<button
|
<Button
|
||||||
type="button"
|
type="button"
|
||||||
|
variant="secondary"
|
||||||
onClick={onCancel}
|
onClick={onCancel}
|
||||||
className="rounded-md border border-border px-4 py-2 text-sm text-muted-foreground hover:bg-accent hover:text-foreground"
|
|
||||||
>
|
>
|
||||||
Cancel
|
Cancel
|
||||||
</button>
|
</Button>
|
||||||
<button
|
<Button type="submit">
|
||||||
type="submit"
|
|
||||||
className="rounded-md bg-gradient-brand px-4 py-2 text-sm font-medium text-white shadow-lg shadow-primary/20 hover:opacity-90"
|
|
||||||
>
|
|
||||||
Start Procedure
|
Start Procedure
|
||||||
</button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
import { useState } from 'react'
|
import { useState } from 'react'
|
||||||
import { Modal } from '@/components/common/Modal'
|
import { Modal } from '@/components/common/Modal'
|
||||||
import { GitFork, Loader2 } from 'lucide-react'
|
import { GitFork } from 'lucide-react'
|
||||||
import { cn } from '@/lib/utils'
|
import { cn } from '@/lib/utils'
|
||||||
|
import { Button } from '@/components/ui/Button'
|
||||||
|
|
||||||
interface ForkTreeModalProps {
|
interface ForkTreeModalProps {
|
||||||
isOpen: boolean
|
isOpen: boolean
|
||||||
@@ -44,38 +45,21 @@ export function ForkTreeModal({
|
|||||||
|
|
||||||
const footer = (
|
const footer = (
|
||||||
<div className="flex justify-end gap-3">
|
<div className="flex justify-end gap-3">
|
||||||
<button
|
<Button
|
||||||
|
variant="ghost"
|
||||||
onClick={onSkip}
|
onClick={onSkip}
|
||||||
disabled={isSaving}
|
disabled={isSaving}
|
||||||
className={cn(
|
|
||||||
'rounded-md px-4 py-2 text-sm font-medium transition-colors',
|
|
||||||
'text-muted-foreground hover:bg-accent hover:text-foreground',
|
|
||||||
'disabled:cursor-not-allowed disabled:opacity-50'
|
|
||||||
)}
|
|
||||||
>
|
>
|
||||||
Skip
|
Skip
|
||||||
</button>
|
</Button>
|
||||||
<button
|
<Button
|
||||||
onClick={handleFork}
|
onClick={handleFork}
|
||||||
disabled={isSaving || !name.trim()}
|
disabled={!name.trim()}
|
||||||
className={cn(
|
loading={isSaving}
|
||||||
'flex items-center gap-2 rounded-md bg-gradient-brand text-white shadow-lg shadow-primary/20 px-4 py-2 text-sm font-medium transition-colors',
|
|
||||||
'hover:opacity-90',
|
|
||||||
'disabled:cursor-not-allowed disabled:opacity-50'
|
|
||||||
)}
|
|
||||||
>
|
>
|
||||||
{isSaving ? (
|
<GitFork className="h-4 w-4" />
|
||||||
<>
|
Save as Personal Tree
|
||||||
<Loader2 className="h-4 w-4 animate-spin" />
|
</Button>
|
||||||
Saving...
|
|
||||||
</>
|
|
||||||
) : (
|
|
||||||
<>
|
|
||||||
<GitFork className="h-4 w-4" />
|
|
||||||
Save as Personal Tree
|
|
||||||
</>
|
|
||||||
)}
|
|
||||||
</button>
|
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import { useState } from 'react'
|
import { useState } from 'react'
|
||||||
import { X } from 'lucide-react'
|
import { X } from 'lucide-react'
|
||||||
import { cn } from '@/lib/utils'
|
import { cn } from '@/lib/utils'
|
||||||
|
import { Button } from '@/components/ui/Button'
|
||||||
|
|
||||||
interface SaveSessionAsTreeModalProps {
|
interface SaveSessionAsTreeModalProps {
|
||||||
isOpen: boolean
|
isOpen: boolean
|
||||||
@@ -130,27 +131,20 @@ export function SaveSessionAsTreeModal({
|
|||||||
|
|
||||||
{/* Actions */}
|
{/* Actions */}
|
||||||
<div className="flex justify-end gap-2 pt-2">
|
<div className="flex justify-end gap-2 pt-2">
|
||||||
<button
|
<Button
|
||||||
type="button"
|
type="button"
|
||||||
|
variant="secondary"
|
||||||
onClick={onClose}
|
onClick={onClose}
|
||||||
disabled={isSaving}
|
disabled={isSaving}
|
||||||
className={cn(
|
|
||||||
'rounded-md border border-border px-4 py-2 text-sm font-medium text-muted-foreground',
|
|
||||||
'hover:bg-accent hover:text-foreground disabled:opacity-50'
|
|
||||||
)}
|
|
||||||
>
|
>
|
||||||
Cancel
|
Cancel
|
||||||
</button>
|
</Button>
|
||||||
<button
|
<Button
|
||||||
type="submit"
|
type="submit"
|
||||||
disabled={isSaving}
|
loading={isSaving}
|
||||||
className={cn(
|
|
||||||
'rounded-md bg-gradient-brand px-4 py-2 text-sm font-medium text-white shadow-lg shadow-primary/20',
|
|
||||||
'hover:opacity-90 disabled:opacity-50'
|
|
||||||
)}
|
|
||||||
>
|
>
|
||||||
{isSaving ? 'Saving...' : 'Save as Tree'}
|
Save as Tree
|
||||||
</button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import { useRef } from 'react'
|
|||||||
import { Modal } from '@/components/common/Modal'
|
import { Modal } from '@/components/common/Modal'
|
||||||
import { cn } from '@/lib/utils'
|
import { cn } from '@/lib/utils'
|
||||||
import type { SessionOutcome } from '@/types'
|
import type { SessionOutcome } from '@/types'
|
||||||
|
import { Button } from '@/components/ui/Button'
|
||||||
|
|
||||||
interface SessionOutcomeModalProps {
|
interface SessionOutcomeModalProps {
|
||||||
isOpen: boolean
|
isOpen: boolean
|
||||||
@@ -46,28 +47,21 @@ export function SessionOutcomeModal({
|
|||||||
title="Session Outcome"
|
title="Session Outcome"
|
||||||
footer={(
|
footer={(
|
||||||
<div className="flex justify-end gap-2">
|
<div className="flex justify-end gap-2">
|
||||||
<button
|
<Button
|
||||||
type="button"
|
type="button"
|
||||||
|
variant="secondary"
|
||||||
onClick={onClose}
|
onClick={onClose}
|
||||||
disabled={isSubmitting}
|
disabled={isSubmitting}
|
||||||
className={cn(
|
|
||||||
'rounded-md border border-border px-4 py-2 text-sm font-medium text-muted-foreground',
|
|
||||||
'hover:bg-accent hover:text-foreground disabled:opacity-50'
|
|
||||||
)}
|
|
||||||
>
|
>
|
||||||
Cancel
|
Cancel
|
||||||
</button>
|
</Button>
|
||||||
<button
|
<Button
|
||||||
type="button"
|
type="button"
|
||||||
onClick={handleSubmit}
|
onClick={handleSubmit}
|
||||||
disabled={isSubmitting}
|
loading={isSubmitting}
|
||||||
className={cn(
|
|
||||||
'rounded-md bg-gradient-brand text-white shadow-lg shadow-primary/20 px-4 py-2 text-sm font-medium',
|
|
||||||
'hover:opacity-90 disabled:opacity-50'
|
|
||||||
)}
|
|
||||||
>
|
>
|
||||||
{isSubmitting ? 'Completing...' : 'Complete Session'}
|
Complete Session
|
||||||
</button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import { cn } from '@/lib/utils'
|
|||||||
import { toast } from '@/lib/toast'
|
import { toast } from '@/lib/toast'
|
||||||
import { Spinner } from '@/components/common/Spinner'
|
import { Spinner } from '@/components/common/Spinner'
|
||||||
import { Modal } from '@/components/common/Modal'
|
import { Modal } from '@/components/common/Modal'
|
||||||
|
import { Button } from '@/components/ui/Button'
|
||||||
|
|
||||||
interface ShareSessionModalProps {
|
interface ShareSessionModalProps {
|
||||||
sessionId: string
|
sessionId: string
|
||||||
@@ -180,15 +181,9 @@ export function ShareSessionModal({ sessionId, sessionLabel, isOpen, onClose }:
|
|||||||
size="lg"
|
size="lg"
|
||||||
footer={
|
footer={
|
||||||
<div className="flex justify-end">
|
<div className="flex justify-end">
|
||||||
<button
|
<Button variant="secondary" onClick={onClose}>
|
||||||
onClick={onClose}
|
|
||||||
className={cn(
|
|
||||||
'rounded-md border border-border px-4 py-2 text-sm font-medium text-muted-foreground',
|
|
||||||
'hover:bg-accent hover:text-foreground'
|
|
||||||
)}
|
|
||||||
>
|
|
||||||
Close
|
Close
|
||||||
</button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
@@ -300,17 +295,15 @@ export function ShareSessionModal({ sessionId, sessionLabel, isOpen, onClose }:
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Generate Button */}
|
{/* Generate Button */}
|
||||||
<button
|
<Button
|
||||||
onClick={handleGenerateLink}
|
onClick={handleGenerateLink}
|
||||||
disabled={isGenerating || (expirationPreset === 'custom' && !customDatetime)}
|
disabled={expirationPreset === 'custom' && !customDatetime}
|
||||||
className={cn(
|
loading={isGenerating}
|
||||||
'flex w-full items-center justify-center gap-2 rounded-md bg-gradient-brand px-4 py-2 text-sm font-medium text-white shadow-lg shadow-primary/20',
|
className="w-full"
|
||||||
'hover:opacity-90 disabled:opacity-50 disabled:cursor-not-allowed'
|
|
||||||
)}
|
|
||||||
>
|
>
|
||||||
<Link2 className="h-4 w-4" />
|
<Link2 className="h-4 w-4" />
|
||||||
{isGenerating ? 'Generating...' : 'Generate Link'}
|
Generate Link
|
||||||
</button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Existing Shares */}
|
{/* Existing Shares */}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import { X, ThumbsUp, ThumbsDown } from 'lucide-react'
|
|||||||
import { StarRating } from '@/components/common/StarRating'
|
import { StarRating } from '@/components/common/StarRating'
|
||||||
import { cn } from '@/lib/utils'
|
import { cn } from '@/lib/utils'
|
||||||
import type { Step } from '@/types'
|
import type { Step } from '@/types'
|
||||||
|
import { Button } from '@/components/ui/Button'
|
||||||
|
|
||||||
interface StepRatingData {
|
interface StepRatingData {
|
||||||
rating: number
|
rating: number
|
||||||
@@ -190,28 +191,21 @@ export function StepRatingModal({
|
|||||||
|
|
||||||
{/* Footer */}
|
{/* Footer */}
|
||||||
<div className="flex justify-end gap-2 border-t border-border px-6 py-4">
|
<div className="flex justify-end gap-2 border-t border-border px-6 py-4">
|
||||||
<button
|
<Button
|
||||||
type="button"
|
type="button"
|
||||||
|
variant="secondary"
|
||||||
onClick={onClose}
|
onClick={onClose}
|
||||||
disabled={isSaving}
|
disabled={isSaving}
|
||||||
className={cn(
|
|
||||||
'rounded-md border border-border px-4 py-2 text-sm font-medium text-muted-foreground',
|
|
||||||
'hover:bg-accent hover:text-foreground disabled:opacity-50'
|
|
||||||
)}
|
|
||||||
>
|
>
|
||||||
Skip
|
Skip
|
||||||
</button>
|
</Button>
|
||||||
<button
|
<Button
|
||||||
type="button"
|
type="button"
|
||||||
onClick={handleSubmit}
|
onClick={handleSubmit}
|
||||||
disabled={isSaving}
|
loading={isSaving}
|
||||||
className={cn(
|
|
||||||
'rounded-md bg-gradient-brand px-4 py-2 text-sm font-medium text-white shadow-lg shadow-primary/20',
|
|
||||||
'hover:opacity-90 disabled:opacity-50'
|
|
||||||
)}
|
|
||||||
>
|
>
|
||||||
{isSaving ? 'Submitting...' : 'Submit Ratings'}
|
Submit Ratings
|
||||||
</button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import { useState } from 'react'
|
import { useState } from 'react'
|
||||||
import { cn } from '@/lib/utils'
|
import { cn } from '@/lib/utils'
|
||||||
|
import { Button } from '@/components/ui/Button'
|
||||||
|
|
||||||
interface VariablePromptModalProps {
|
interface VariablePromptModalProps {
|
||||||
/** The prompt text from [USER_INPUT:prompt] */
|
/** The prompt text from [USER_INPUT:prompt] */
|
||||||
@@ -45,26 +46,20 @@ export function VariablePromptModal({ prompt, onSubmit, onCancel }: VariableProm
|
|||||||
/>
|
/>
|
||||||
|
|
||||||
<div className="mt-4 flex gap-2">
|
<div className="mt-4 flex gap-2">
|
||||||
<button
|
<Button
|
||||||
type="submit"
|
type="submit"
|
||||||
disabled={!value.trim()}
|
disabled={!value.trim()}
|
||||||
className={cn(
|
className="flex-1"
|
||||||
'flex-1 rounded-lg bg-gradient-brand px-4 py-2 text-sm font-medium text-white shadow-lg shadow-primary/20',
|
|
||||||
'hover:opacity-90 disabled:opacity-50 disabled:cursor-not-allowed'
|
|
||||||
)}
|
|
||||||
>
|
>
|
||||||
Continue
|
Continue
|
||||||
</button>
|
</Button>
|
||||||
<button
|
<Button
|
||||||
type="button"
|
type="button"
|
||||||
|
variant="secondary"
|
||||||
onClick={onCancel}
|
onClick={onCancel}
|
||||||
className={cn(
|
|
||||||
'rounded-lg border border-border px-4 py-2 text-sm font-medium text-muted-foreground',
|
|
||||||
'hover:bg-accent hover:text-foreground'
|
|
||||||
)}
|
|
||||||
>
|
>
|
||||||
Skip
|
Skip
|
||||||
</button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import { cn } from '@/lib/utils'
|
|||||||
import { MarkdownContent } from '@/components/ui/MarkdownContent'
|
import { MarkdownContent } from '@/components/ui/MarkdownContent'
|
||||||
import { stepsApi } from '@/api/steps'
|
import { stepsApi } from '@/api/steps'
|
||||||
import type { Step, Review } from '@/types/step'
|
import type { Step, Review } from '@/types/step'
|
||||||
|
import { Button } from '@/components/ui/Button'
|
||||||
|
|
||||||
interface StepDetailModalProps {
|
interface StepDetailModalProps {
|
||||||
stepId: string
|
stepId: string
|
||||||
@@ -318,22 +319,20 @@ export function StepDetailModal({ stepId, onClose, onInsert }: StepDetailModalPr
|
|||||||
|
|
||||||
{/* Footer - Actions */}
|
{/* Footer - Actions */}
|
||||||
<div className="flex gap-2 border-t border-border p-4">
|
<div className="flex gap-2 border-t border-border p-4">
|
||||||
<button
|
<Button
|
||||||
|
variant="secondary"
|
||||||
onClick={onClose}
|
onClick={onClose}
|
||||||
className="flex-1 rounded-md border border-border px-4 py-2 text-sm font-medium text-muted-foreground hover:bg-accent hover:text-foreground"
|
className="flex-1"
|
||||||
>
|
>
|
||||||
Cancel
|
Cancel
|
||||||
</button>
|
</Button>
|
||||||
<button
|
<Button
|
||||||
onClick={handleInsert}
|
onClick={handleInsert}
|
||||||
disabled={!step}
|
disabled={!step}
|
||||||
className={cn(
|
className="flex-1"
|
||||||
'flex-1 rounded-md bg-gradient-brand px-4 py-2 text-sm font-medium text-white shadow-lg shadow-primary/20',
|
|
||||||
'hover:opacity-90 disabled:opacity-50'
|
|
||||||
)}
|
|
||||||
>
|
>
|
||||||
Insert Into Session
|
Insert Into Session
|
||||||
</button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import { Plus, X, HelpCircle, Zap, CheckCircle } from 'lucide-react'
|
|||||||
import { cn } from '@/lib/utils'
|
import { cn } from '@/lib/utils'
|
||||||
import { stepCategoriesApi } from '@/api/stepCategories'
|
import { stepCategoriesApi } from '@/api/stepCategories'
|
||||||
import type { StepCreate, StepCategory, StepCommand } from '@/types/step'
|
import type { StepCreate, StepCategory, StepCommand } from '@/types/step'
|
||||||
|
import { Button } from '@/components/ui/Button'
|
||||||
|
|
||||||
interface StepFormProps {
|
interface StepFormProps {
|
||||||
onSubmit: (data: StepCreate) => void
|
onSubmit: (data: StepCreate) => void
|
||||||
@@ -369,20 +370,21 @@ export function StepForm({ onSubmit, onCancel, initialData, submitLabel, isSubmi
|
|||||||
|
|
||||||
{/* Actions */}
|
{/* Actions */}
|
||||||
<div className="flex gap-2 pt-4">
|
<div className="flex gap-2 pt-4">
|
||||||
<button
|
<Button
|
||||||
type="button"
|
type="button"
|
||||||
|
variant="secondary"
|
||||||
onClick={onCancel}
|
onClick={onCancel}
|
||||||
className="flex-1 rounded-md border border-border px-4 py-2 text-sm font-medium text-muted-foreground hover:bg-accent hover:text-foreground"
|
className="flex-1"
|
||||||
>
|
>
|
||||||
Cancel
|
Cancel
|
||||||
</button>
|
</Button>
|
||||||
<button
|
<Button
|
||||||
type="submit"
|
type="submit"
|
||||||
disabled={isSubmitting}
|
loading={isSubmitting}
|
||||||
className="flex-1 rounded-md bg-gradient-brand text-white shadow-lg shadow-primary/20 px-4 py-2 text-sm font-medium hover:opacity-90 disabled:opacity-50"
|
className="flex-1"
|
||||||
>
|
>
|
||||||
{isSubmitting ? 'Saving...' : (submitLabel ?? 'Insert Step')}
|
{submitLabel ?? 'Insert Step'}
|
||||||
</button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import { useState } from 'react'
|
|||||||
import { X, Check, SkipForward, Sparkles, ChevronDown, ChevronUp } from 'lucide-react'
|
import { X, Check, SkipForward, Sparkles, ChevronDown, ChevronUp } from 'lucide-react'
|
||||||
import { cn } from '@/lib/utils'
|
import { cn } from '@/lib/utils'
|
||||||
import type { AIFixProposal } from '@/types'
|
import type { AIFixProposal } from '@/types'
|
||||||
|
import { Button } from '@/components/ui/Button'
|
||||||
|
|
||||||
interface AIFixReviewModalProps {
|
interface AIFixReviewModalProps {
|
||||||
fixes: AIFixProposal[]
|
fixes: AIFixProposal[]
|
||||||
@@ -125,20 +126,21 @@ export function AIFixReviewModal({ fixes, onApply, onApplyAll, onClose }: AIFixR
|
|||||||
|
|
||||||
{/* Action buttons */}
|
{/* Action buttons */}
|
||||||
<div className="mt-3 flex gap-2">
|
<div className="mt-3 flex gap-2">
|
||||||
<button
|
<Button
|
||||||
|
size="sm"
|
||||||
onClick={() => handleApply(fix)}
|
onClick={() => handleApply(fix)}
|
||||||
className="flex items-center gap-1 rounded-md bg-gradient-brand px-3 py-1.5 text-xs font-medium text-white shadow-xs shadow-primary/20 hover:opacity-90"
|
|
||||||
>
|
>
|
||||||
<Check className="h-3 w-3" />
|
<Check className="h-3 w-3" />
|
||||||
Apply
|
Apply
|
||||||
</button>
|
</Button>
|
||||||
<button
|
<Button
|
||||||
|
variant="secondary"
|
||||||
|
size="sm"
|
||||||
onClick={() => handleSkip(fix)}
|
onClick={() => handleSkip(fix)}
|
||||||
className="flex items-center gap-1 rounded-md border border-border px-3 py-1.5 text-xs font-medium text-muted-foreground hover:bg-accent hover:text-foreground"
|
|
||||||
>
|
>
|
||||||
<SkipForward className="h-3 w-3" />
|
<SkipForward className="h-3 w-3" />
|
||||||
Skip
|
Skip
|
||||||
</button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
@@ -149,19 +151,13 @@ export function AIFixReviewModal({ fixes, onApply, onApplyAll, onClose }: AIFixR
|
|||||||
|
|
||||||
{/* Footer */}
|
{/* Footer */}
|
||||||
<div className="flex items-center justify-between border-t border-border px-6 py-4">
|
<div className="flex items-center justify-between border-t border-border px-6 py-4">
|
||||||
<button
|
<Button variant="secondary" onClick={onClose}>
|
||||||
onClick={onClose}
|
|
||||||
className="rounded-md border border-border px-4 py-2 text-sm font-medium text-muted-foreground hover:bg-accent hover:text-foreground"
|
|
||||||
>
|
|
||||||
{allHandled ? 'Done' : 'Cancel'}
|
{allHandled ? 'Done' : 'Cancel'}
|
||||||
</button>
|
</Button>
|
||||||
{!allHandled && (
|
{!allHandled && (
|
||||||
<button
|
<Button onClick={onApplyAll}>
|
||||||
onClick={onApplyAll}
|
|
||||||
className="rounded-md bg-gradient-brand px-4 py-2 text-sm font-medium text-white shadow-lg shadow-primary/20 hover:opacity-90"
|
|
||||||
>
|
|
||||||
Apply All ({pendingFixes.length})
|
Apply All ({pendingFixes.length})
|
||||||
</button>
|
</Button>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import { NodeFormDecision } from './NodeFormDecision'
|
|||||||
import { NodeFormAction } from './NodeFormAction'
|
import { NodeFormAction } from './NodeFormAction'
|
||||||
import { NodeFormResolution } from './NodeFormResolution'
|
import { NodeFormResolution } from './NodeFormResolution'
|
||||||
import type { TreeStructure } from '@/types'
|
import type { TreeStructure } from '@/types'
|
||||||
|
import { Button } from '@/components/ui/Button'
|
||||||
|
|
||||||
interface NodeEditorModalProps {
|
interface NodeEditorModalProps {
|
||||||
node: TreeStructure
|
node: TreeStructure
|
||||||
@@ -65,20 +66,19 @@ export function NodeEditorModal({ node, onClose, isNewNode = false }: NodeEditor
|
|||||||
|
|
||||||
const footerContent = (
|
const footerContent = (
|
||||||
<div className="flex justify-end gap-2">
|
<div className="flex justify-end gap-2">
|
||||||
<button
|
<Button
|
||||||
type="button"
|
type="button"
|
||||||
|
variant="secondary"
|
||||||
onClick={handleCancel}
|
onClick={handleCancel}
|
||||||
className="rounded-md border border-border px-4 py-2 text-sm font-medium text-muted-foreground hover:bg-accent hover:text-foreground"
|
|
||||||
>
|
>
|
||||||
Cancel
|
Cancel
|
||||||
</button>
|
</Button>
|
||||||
<button
|
<Button
|
||||||
type="button"
|
type="button"
|
||||||
onClick={handleSave}
|
onClick={handleSave}
|
||||||
className="rounded-md bg-gradient-brand text-white shadow-lg shadow-primary/20 px-4 py-2 text-sm font-medium hover:opacity-90"
|
|
||||||
>
|
>
|
||||||
Done
|
Done
|
||||||
</button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user