Skip to content

Commit

Permalink
Merge pull request #22 from markusbink/16-ui-parteivortrag-thread
Browse files Browse the repository at this point in the history
16 UI parteivortrag thread
  • Loading branch information
markusbink committed Aug 20, 2022
2 parents 603819a + e796d46 commit a984afa
Show file tree
Hide file tree
Showing 8 changed files with 362 additions and 206 deletions.
5 changes: 4 additions & 1 deletion src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { useEffect, useState } from "react";
import { EntryProvider } from "./contexts";
import { Auth } from "./pages/Auth";
import { Main } from "./pages/Main";

Expand All @@ -21,7 +22,9 @@ export const App = () => {
return (
<div className="App h-screen">
{isAuthenticated ? (
<Main />
<EntryProvider>
<Main />
</EntryProvider>
) : (
<Auth setIsAuthenticated={setIsAuthenticated} />
)}
Expand Down
67 changes: 29 additions & 38 deletions src/components/Discussion.tsx
Original file line number Diff line number Diff line change
@@ -1,46 +1,37 @@
import { IEntry, UserRole } from "../types";
import { Entry } from "./entry";
import { useEntries } from "../contexts";
import { EntryList } from "./entry";

const mockEntries: IEntry[] = [
{
id: "1f1f2fa4-13fa-11ed-861d-0242ac120002",
version: 1,
text: "Lorem Ipsum is simply <strong>dummy text</strong> of the printing and typesetting industry.",
author: "Stefan Schneider",
role: "Kläger",
section_id: "d990191e-13fc-11ed-861d-0242ac120002",
},
{
id: "257550a4-13fa-11ed-861d-0242ac120002",
version: 2,
text: "Lorem Ipsum has been the <i>industry's standard dummy text</i>ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.",
author: "Michael Bauer",
role: "Beklagter",
section_id: "d990191e-13fc-11ed-861d-0242ac120002",
associated_entry: "1f1f2fa4-13fa-11ed-861d-0242ac120002",
},
];
const mockSections: string[] = ["d990191e-13fc-11ed-861d-0242ac120002"];

export const Discussion = () => {
const { groupedEntries, displayAsColumn, setDisplayAsColumn } = useEntries();

return (
<div className="bg-offWhite h-full overflow-y-scroll p-4 space-y-4">
<div className="bg-offWhite h-full overflow-y-scroll py-28 px-4 space-y-4">
<div className="max-w-[1200px] m-auto">
<section className="space-y-8">
<div className="text-xl font-bold">
<span>1.</span> Gliederungspunkt
</div>
<div className="space-y-8">
{mockEntries.map((entry, index) => (
<Entry
key={entry.id}
entry={entry}
isBookmarked={index % 2 === 0}
isOld={index % 2 === 0}
viewedBy={UserRole.Judge}
/>
))}
</div>
</section>
<label className="inline-flex items-center gap-2 cursor-pointer select-none mb-4">
<input
id="default-checkbox"
type="checkbox"
value=""
onChange={() => setDisplayAsColumn(!displayAsColumn)}
className="w-4 h-4 "
/>
View as Thread?
</label>
{mockSections.map((sectionId) => {
const sectionEntries = groupedEntries[sectionId];
return (
<section key={sectionId} className="space-y-8">
<div className="text-xl font-bold">
<span>1.</span> Gliederungspunkt
</div>
<div className="space-y-8">
<EntryList entries={sectionEntries["parent"]} />
</div>
</section>
);
})}
</div>
</div>
);
Expand Down
Loading

0 comments on commit a984afa

Please sign in to comment.