fix(stores): consolidated some store values

This commit is contained in:
Emir Karabeg
2025-02-18 00:47:38 -08:00
parent 5c86d1de16
commit fb5272cb4e
3 changed files with 17 additions and 5 deletions

View File

@@ -152,7 +152,13 @@ export default function LoginPage() {
</div>
<div className="space-y-2">
<Label htmlFor="password">Password</Label>
<Input id="password" name="password" type="password" required />
<Input
id="password"
name="password"
type="password"
placeholder="Enter your password"
required
/>
</div>
<Button type="submit" className="w-full" disabled={isLoading}>
{isLoading ? 'Signing in...' : 'Sign in'}

View File

@@ -32,7 +32,7 @@ import { NotificationDropdownItem } from './components/notification-dropdown-ite
export function ControlBar() {
const { notifications, getWorkflowNotifications } = useNotificationStore()
const { history, undo, redo, revertToHistoryState } = useWorkflowStore()
const { history, undo, redo, revertToHistoryState, lastSaved } = useWorkflowStore()
const [isEditing, setIsEditing] = useState(false)
const [editedName, setEditedName] = useState('')
const { workflows, updateWorkflow, activeWorkflowId, removeWorkflow } = useWorkflowRegistry()
@@ -125,10 +125,10 @@ export function ControlBar() {
{activeWorkflowId ? workflows[activeWorkflowId].name : 'Workflow'}
</h2>
)}
{mounted && ( // Only render the timestamp after client-side hydration
{mounted && (
<p className="text-xs text-muted-foreground">
Saved{' '}
{formatDistanceToNow(history.present.timestamp, {
{formatDistanceToNow(lastSaved || Date.now(), {
addSuffix: true,
})}
</p>

View File

@@ -20,6 +20,8 @@ export function General() {
const router = useRouter()
const isAutoConnectEnabled = useGeneralStore((state) => state.isAutoConnectEnabled)
const toggleAutoConnect = useGeneralStore((state) => state.toggleAutoConnect)
const isDebugModeEnabled = useGeneralStore((state) => state.isDebugModeEnabled)
const toggleDebugMode = useGeneralStore((state) => state.toggleDebugMode)
const handleResetData = () => {
resetAllStores()
@@ -35,7 +37,11 @@ export function General() {
<Label htmlFor="debug-mode" className="font-medium">
Debug mode
</Label>
<Switch id="debug-mode" />
<Switch
id="debug-mode"
checked={isDebugModeEnabled}
onCheckedChange={toggleDebugMode}
/>
</div>
<div className="flex items-center justify-between py-1">
<Label htmlFor="auto-connect" className="font-medium">