// directory.jsx — business directory + shared bottom sheets. Exported to window.
// ---------- generic bottom sheet ----------
function Sheet({ children, onClose, height = '72%' }) {
return (
e.stopPropagation()} style={{ height, background: 'var(--surface)',
borderTopLeftRadius: 24, borderTopRightRadius: 24, boxShadow: 'var(--sh-up)', display: 'flex', flexDirection: 'column',
overflow: 'hidden', animation: 'gsSheetUp 280ms var(--ease)' }}>
{children}
);
}
function SheetAction({ icon, label, onClick, primary }) {
return (
Diskusi {list ? '(' + list.length + ')' : ''}
{list === null &&
Memuat...
}
{list && list.length === 0 &&
Belum ada komentar. Mulai diskusi.
}
{list && list.map(cm => (
{(cm.author || 'W')[0].toUpperCase()}
{cm.author}
{cm.time}
{cm.body}
))}
setBody(e.target.value)} onKeyDown={e => { if (e.key === 'Enter') send(); }}
placeholder={authed ? "Tulis komentar..." : "Masuk untuk berkomentar"} onFocus={() => { if (!authed && onRequireAuth) onRequireAuth(); }} style={{ flex: 1, padding: '11px 14px', borderRadius: 'var(--r-chip)', border: '1px solid var(--border)', background: 'var(--surface-2)', fontFamily: 'var(--font)', fontSize: 13.5, color: 'var(--text-1)', outline: 'none' }} />
);
}
function ReportDetailSheet({ report, onClose, myUps = {}, onUp, authed, onRequireAuth }) {
const c = CATS[report.cat] || CATS.lainnya;
const upActive = !!myUps[report.id];
const tl = {
open: [['Dilaporkan', report.time, true], ['Ditinjau pengurus', 'menunggu', false]],
proses: [['Dilaporkan', report.time, true], ['Diterima pengurus', 'aktif', true], ['Sedang ditangani', 'aktif', true], ['Selesai', 'menunggu', false]],
selesai: [['Dilaporkan', report.time, true], ['Ditangani', 'selesai', true], ['Selesai', 'beres', true]],
}[report.status];
return (
setCat('all')}>Semua
{DIR_CATS.map(d => (
setCat(d.key)} color={d.color}>
{d.label}
))}
{places.some(p => p.sponsored) && (
)}
{shown.length} tempat
{['grid', 'list'].map(v => (
))}
{view === 'grid' ? (
{shown.length === 0 ? (
Direktori bisnis segera hadir.
) : shown.map(p =>
)}
) : (
)}
);
}
function PlaceRow({ place, onOpen }) {
const dc = DIR_CATS.find(d => d.key === place.cat) || DIR_CATS[0];
return (