ObjectCreation:
- Filter: only shows pictures where objects_created=false
- New '✓ Alle Objekte erstellt' button (enabled when ≥1 object linked)
→ PATCHes picture with objects_created:true + auto timestamp
→ removes picture from list immediately
ContentHub:
- Statement Creation tile enabled (was: grayed out)
api.js:
- getUserLang() → reads native_lang from stored user (default 'de')
- langField(suffix) → returns e.g. 'sentence_de' based on user lang
- login() stores native_lang in localStorage user object
StatementCreation (/content/statements):
- Shows pictures where objects_created=true
- Left 1/5: clickable objects list → highlights selections on canvas
- Center 2/5: image with canvas, draws selected object's polygons in color
- Right 2/5: PairsPanel
- answer_type dropdown + 'Add new pair' toggle
- PairForm: Question / Positive / Negative textareas
- HighlightedTextarea: overlay technique, auto-detects words from DB
(debounced GET /words?titel_de=, colored mark via rgba background)
- 'Als Wort erstellen' button when text is selected
- 'Save pair' → creates question + 2 separate statements + pair
→ sentences stored with {{uuid}} placeholders for matched words
→ pair linked to selected object
- List of existing pairs with question/positive/negative preview
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
33 lines
1.3 KiB
JavaScript
33 lines
1.3 KiB
JavaScript
import { BrowserRouter, Routes, Route, Navigate } from 'react-router-dom';
|
|
import { getUser } from './lib/api';
|
|
import Login from './pages/Login';
|
|
import Dashboard from './pages/Dashboard';
|
|
import DatabaseAdmin from './pages/DatabaseAdmin';
|
|
import TableView from './pages/TableView';
|
|
import ContentHub from './pages/ContentHub';
|
|
import ObjectCreation from './pages/ObjectCreation';
|
|
import StatementCreation from './pages/StatementCreation';
|
|
|
|
function RequireAuth({ children }) {
|
|
const user = getUser();
|
|
if (!user) return <Navigate to="/login" replace />;
|
|
return children;
|
|
}
|
|
|
|
export default function App() {
|
|
return (
|
|
<BrowserRouter>
|
|
<Routes>
|
|
<Route path="/login" element={<Login />} />
|
|
<Route path="/" element={<RequireAuth><Dashboard /></RequireAuth>} />
|
|
<Route path="/db" element={<RequireAuth><DatabaseAdmin /></RequireAuth>} />
|
|
<Route path="/db/:tableKey" element={<RequireAuth><TableView /></RequireAuth>} />
|
|
<Route path="/content" element={<RequireAuth><ContentHub /></RequireAuth>} />
|
|
<Route path="/content/objects" element={<RequireAuth><ObjectCreation /></RequireAuth>} />
|
|
<Route path="/content/statements" element={<RequireAuth><StatementCreation /></RequireAuth>} />
|
|
<Route path="*" element={<Navigate to="/" replace />} />
|
|
</Routes>
|
|
</BrowserRouter>
|
|
);
|
|
}
|