import React, { useEffect } from 'react'
import { Link } from 'react-router-dom'
import { useStore } from '@nanostores/react'
import {
isStandbyStore,
currentTimeStore,
weatherStore,
showChoicesStore,
showSettingsModalStore,
isVisibleStore,
yenBalanceStore,
toggleStandby,
toggleShowChoices,
updateTime
} from '../stores'
interface VNInterfaceProps {
onLogout: () => void
}
export function VNInterface({ onLogout }: VNInterfaceProps) {
const isStandby = useStore(isStandbyStore)
const currentTime = useStore(currentTimeStore)
const weather = useStore(weatherStore)
const showChoices = useStore(showChoicesStore)
const showSettingsModal = useStore(showSettingsModalStore)
const isVisible = useStore(isVisibleStore)
const yenBalance = useStore(yenBalanceStore)
// Fade in effect on mount
useEffect(() => {
const timer = setTimeout(() => {
isVisibleStore.set(true)
}, 100)
return () => clearTimeout(timer)
}, [])
// Update clock every second (Japan Time)
useEffect(() => {
const timer = setInterval(() => {
const now = new Date()
// Convert to Japan Time (UTC+9)
const japanTime = new Date(now.getTime() + (now.getTimezoneOffset() * 60000) + (9 * 3600000))
updateTime()
}, 1000)
return () => clearInterval(timer)
}, [])
return (
{/* Background */}
{/* Combined Info Panel (Top Right) */}
{/* Weather Section */}
{/* Time Section */}
{currentTime.toLocaleDateString('ja-JP', {
year: 'numeric',
month: 'long',
day: 'numeric',
weekday: 'short'
})}
{currentTime.toLocaleTimeString('ja-JP', {
hour12: false,
hour: '2-digit',
minute: '2-digit'
})}
{/* Status Section */}
Balance:
¥{yenBalance.toLocaleString()}
System:
{isStandby ? 'STDBY' : 'LIVE'}
Mesh:
Daemons
View:
Contracts
{/* Main VN Viewport */}
{/* Dialogue Panel (Bottom) */}
???
A warm CRT glow fills the room. A figure turns towards you...
{/* Input/Choice Panel (Bottom) */}
{!showChoices ? (
// Text Input Mode
{
if (e.key === 'Enter') {
const target = e.target as HTMLInputElement;
if (target.value.trim()) {
console.log('User input:', target.value);
target.value = '';
}
}
}}
/>
) : (
// Choice Options Mode
)}
{/* Toggle Button */}
{/* Floating Settings Button */}
{/* Settings Modal */}
{showSettingsModal && (
showSettingsModalStore.set(false)}>
e.stopPropagation()}>
Settings
)}
)
}