Skip to content
Snippets Groups Projects
Commit d338cf53 authored by xaralis's avatar xaralis
Browse files

feat: typings polishing, added program

parent 8a647822
No related branches found
No related tags found
No related merge requests found
...@@ -11,13 +11,13 @@ const Announcement = ({ ...@@ -11,13 +11,13 @@ const Announcement = ({
content, content,
link, link,
relatedPostId, relatedPostId,
isSeen, seen,
}) => { }) => {
const wrapperClassName = classNames( const wrapperClassName = classNames(
"bg-opacity-50 border-l-2 px-4 py-2 lg:px-8 lg:py-3", "bg-opacity-50 border-l-2 px-4 py-2 lg:px-8 lg:py-3",
{ {
"bg-grey-50": isSeen, "bg-grey-50": !!seen,
"bg-yellow-100": !isSeen, "bg-yellow-100": !seen,
"border-orange-300": type === "rejected-procedure-proposal", "border-orange-300": type === "rejected-procedure-proposal",
"border-blue-300": type === "suggested-procedure-proposal", "border-blue-300": type === "suggested-procedure-proposal",
"border-green-400": type === "accepted-procedure-proposal", "border-green-400": type === "accepted-procedure-proposal",
......
...@@ -13,7 +13,7 @@ const AnnouncementList = ({ items, className }) => { ...@@ -13,7 +13,7 @@ const AnnouncementList = ({ items, className }) => {
type={item.type} type={item.type}
content={item.content} content={item.content}
link={item.link} link={item.link}
isSeen={item.isSeen} seen={item.seen}
/> />
))} ))}
</div> </div>
......
...@@ -11,16 +11,16 @@ const Post = ({ ...@@ -11,16 +11,16 @@ const Post = ({
type, type,
ranking, ranking,
content, content,
isSeen, seen,
isArchived, archived,
state, state,
originalContent, historyLog,
}) => { }) => {
const wrapperClassName = classNames( const wrapperClassName = classNames(
"flex items-start p-4 lg:p-2 lg:py-4 lg:-mx-2", "flex items-start p-4 lg:p-2 lg:py-4 lg:-mx-2",
{ {
"bg-yellow-100 bg-opacity-50": !isSeen, "bg-yellow-100 bg-opacity-50": !seen,
"opacity-25 hover:opacity-100 transition-opacity duration-200": isArchived, "opacity-25 hover:opacity-100 transition-opacity duration-200": !!archived,
}, },
className className
); );
...@@ -78,7 +78,7 @@ const Post = ({ ...@@ -78,7 +78,7 @@ const Post = ({
); );
} }
if (isArchived) { if (archived) {
labels.push( labels.push(
<Chip <Chip
key="isArchived" key="isArchived"
...@@ -91,6 +91,12 @@ const Post = ({ ...@@ -91,6 +91,12 @@ const Post = ({
); );
} }
const isModified =
(historyLog || []).filter(
(logRecord) =>
logRecord.attribute === "content" && logRecord.originator === "chairman"
).length > 0;
return ( return (
<div className={wrapperClassName}> <div className={wrapperClassName}>
<img <img
...@@ -108,6 +114,11 @@ const Post = ({ ...@@ -108,6 +114,11 @@ const Post = ({
<span className="text-grey-200 text-sm">{author.group}</span> <span className="text-grey-200 text-sm">{author.group}</span>
<span className="text-grey-200 ml-1 text-sm"> <span className="text-grey-200 ml-1 text-sm">
@ {format(datetime, "H:mm")} @ {format(datetime, "H:mm")}
{isModified && (
<span className="text-grey-200 text-xs ml-2 underline">
(Upraveno přesdedajícím)
</span>
)}
</span> </span>
</div> </div>
</div> </div>
......
...@@ -6,20 +6,22 @@ import Post from "./Post"; ...@@ -6,20 +6,22 @@ import Post from "./Post";
const PostList = ({ className, items }) => { const PostList = ({ className, items }) => {
return ( return (
<div className={classNames("space-y-px", className)}> <div className={classNames("space-y-px", className)}>
{items.map((item) => ( {items
<Post .filter((item) => !item.hidden)
key={item.id} .map((item) => (
datetime={item.datetime} <Post
author={item.author} key={item.id}
type={item.type} datetime={item.datetime}
state={item.state} author={item.author}
content={item.content} type={item.type}
originalContent={item.originalContent} state={item.state}
ranking={item.ranking} content={item.content}
isSeen={item.isSeen} ranking={item.ranking}
isArchived={item.isArchived} historyLog={item.historyLog}
/> seen={item.seen}
))} archived={item.archived}
/>
))}
</div> </div>
); );
}; };
......
...@@ -10,7 +10,7 @@ const AnnoucementsContainer = () => { ...@@ -10,7 +10,7 @@ const AnnoucementsContainer = () => {
content: content:
"Shizz fo shizzle mah nizzle fo rizzle, mah home g-dizzle, gravida vizzle, arcu. Pellentesque crunk tortizzle. Sed erizzle. Black izzle sheezy telliv.", "Shizz fo shizzle mah nizzle fo rizzle, mah home g-dizzle, gravida vizzle, arcu. Pellentesque crunk tortizzle. Sed erizzle. Black izzle sheezy telliv.",
datetime: new Date(), datetime: new Date(),
isSeen: false, seen: false,
type: "rejected-procedure-proposal", type: "rejected-procedure-proposal",
}, },
{ {
...@@ -18,7 +18,7 @@ const AnnoucementsContainer = () => { ...@@ -18,7 +18,7 @@ const AnnoucementsContainer = () => {
content: content:
"Shizz fo shizzle mah nizzle fo rizzle, mah home g-dizzle, gravida vizzle, arcu. Pellentesque crunk tortizzle. Sed erizzle. Black izzle sheezy telliv.", "Shizz fo shizzle mah nizzle fo rizzle, mah home g-dizzle, gravida vizzle, arcu. Pellentesque crunk tortizzle. Sed erizzle. Black izzle sheezy telliv.",
datetime: new Date(), datetime: new Date(),
isSeen: false, seen: false,
type: "accepted-procedure-proposal", type: "accepted-procedure-proposal",
}, },
{ {
...@@ -26,7 +26,7 @@ const AnnoucementsContainer = () => { ...@@ -26,7 +26,7 @@ const AnnoucementsContainer = () => {
content: content:
"Shizz fo shizzle mah nizzle fo rizzle, mah home g-dizzle, gravida vizzle, arcu. Pellentesque crunk tortizzle. Sed erizzle. Black izzle sheezy telliv.", "Shizz fo shizzle mah nizzle fo rizzle, mah home g-dizzle, gravida vizzle, arcu. Pellentesque crunk tortizzle. Sed erizzle. Black izzle sheezy telliv.",
datetime: new Date(), datetime: new Date(),
isSeen: true, seen: true,
type: "suggested-procedure-proposal", type: "suggested-procedure-proposal",
}, },
{ {
...@@ -34,7 +34,7 @@ const AnnoucementsContainer = () => { ...@@ -34,7 +34,7 @@ const AnnoucementsContainer = () => {
content: content:
"Shizz fo shizzle mah nizzle fo rizzle, mah home g-dizzle, gravida vizzle, arcu. Pellentesque crunk tortizzle. Sed erizzle. Black izzle sheezy telliv.", "Shizz fo shizzle mah nizzle fo rizzle, mah home g-dizzle, gravida vizzle, arcu. Pellentesque crunk tortizzle. Sed erizzle. Black izzle sheezy telliv.",
datetime: new Date(), datetime: new Date(),
isSeen: true, seen: true,
type: "voting", type: "voting",
}, },
{ {
...@@ -42,7 +42,7 @@ const AnnoucementsContainer = () => { ...@@ -42,7 +42,7 @@ const AnnoucementsContainer = () => {
content: content:
"Shizz fo shizzle mah nizzle fo rizzle, mah home g-dizzle, gravida vizzle, arcu. Pellentesque crunk tortizzle. Sed erizzle. Black izzle sheezy telliv.", "Shizz fo shizzle mah nizzle fo rizzle, mah home g-dizzle, gravida vizzle, arcu. Pellentesque crunk tortizzle. Sed erizzle. Black izzle sheezy telliv.",
datetime: new Date(), datetime: new Date(),
isSeen: true, seen: true,
type: "announcement", type: "announcement",
}, },
{ {
...@@ -50,7 +50,7 @@ const AnnoucementsContainer = () => { ...@@ -50,7 +50,7 @@ const AnnoucementsContainer = () => {
content: content:
"Shizz fo shizzle mah nizzle fo rizzle, mah home g-dizzle, gravida vizzle, arcu. Pellentesque crunk tortizzle. Sed erizzle. Black izzle sheezy telliv.", "Shizz fo shizzle mah nizzle fo rizzle, mah home g-dizzle, gravida vizzle, arcu. Pellentesque crunk tortizzle. Sed erizzle. Black izzle sheezy telliv.",
datetime: new Date(), datetime: new Date(),
isSeen: true, seen: true,
type: "user-ban", type: "user-ban",
}, },
]; ];
......
...@@ -19,8 +19,8 @@ const PostsContainer = ({ className }) => { ...@@ -19,8 +19,8 @@ const PostsContainer = ({ className }) => {
dislikes: 1, dislikes: 1,
score: 4, score: 4,
}, },
isSeen: false, seen: false,
isArchived: false, archived: false,
type: "post", type: "post",
}, },
{ {
...@@ -37,8 +37,8 @@ const PostsContainer = ({ className }) => { ...@@ -37,8 +37,8 @@ const PostsContainer = ({ className }) => {
dislikes: 1, dislikes: 1,
score: 4, score: 4,
}, },
isSeen: false, seen: false,
isArchived: false, archived: false,
type: "post", type: "post",
}, },
{ {
...@@ -55,8 +55,8 @@ const PostsContainer = ({ className }) => { ...@@ -55,8 +55,8 @@ const PostsContainer = ({ className }) => {
dislikes: 1, dislikes: 1,
score: 4, score: 4,
}, },
isSeen: true, seen: true,
isArchived: false, archived: false,
type: "post", type: "post",
}, },
{ {
...@@ -73,8 +73,8 @@ const PostsContainer = ({ className }) => { ...@@ -73,8 +73,8 @@ const PostsContainer = ({ className }) => {
dislikes: 1, dislikes: 1,
score: 4, score: 4,
}, },
isSeen: true, seen: true,
isArchived: false, archived: false,
type: "post", type: "post",
}, },
{ {
...@@ -91,8 +91,8 @@ const PostsContainer = ({ className }) => { ...@@ -91,8 +91,8 @@ const PostsContainer = ({ className }) => {
dislikes: 1, dislikes: 1,
score: 4, score: 4,
}, },
isSeen: true, seen: true,
isArchived: false, archived: false,
type: "post", type: "post",
}, },
{ {
...@@ -109,8 +109,8 @@ const PostsContainer = ({ className }) => { ...@@ -109,8 +109,8 @@ const PostsContainer = ({ className }) => {
dislikes: 1, dislikes: 1,
score: 4, score: 4,
}, },
isSeen: true, seen: true,
isArchived: true, archived: true,
type: "post", type: "post",
}, },
{ {
...@@ -127,8 +127,8 @@ const PostsContainer = ({ className }) => { ...@@ -127,8 +127,8 @@ const PostsContainer = ({ className }) => {
dislikes: 1, dislikes: 1,
score: 4, score: 4,
}, },
isSeen: true, seen: true,
isArchived: true, archived: true,
type: "procedure-proposal", type: "procedure-proposal",
state: "pending", state: "pending",
}, },
...@@ -146,10 +146,18 @@ const PostsContainer = ({ className }) => { ...@@ -146,10 +146,18 @@ const PostsContainer = ({ className }) => {
dislikes: 1, dislikes: 1,
score: 4, score: 4,
}, },
isSeen: true, seen: true,
isArchived: false, archived: false,
type: "procedure-proposal", type: "procedure-proposal",
state: "announced", state: "announced",
historyLog: [
{
attribute: "content",
datetime: new Date(),
newValue: "Lemme know",
originator: "chairman",
},
],
}, },
{ {
id: "9", id: "9",
...@@ -165,8 +173,8 @@ const PostsContainer = ({ className }) => { ...@@ -165,8 +173,8 @@ const PostsContainer = ({ className }) => {
dislikes: 1, dislikes: 1,
score: 4, score: 4,
}, },
isSeen: true, seen: true,
isArchived: false, archived: false,
type: "procedure-proposal", type: "procedure-proposal",
state: "accepted", state: "accepted",
}, },
...@@ -184,8 +192,8 @@ const PostsContainer = ({ className }) => { ...@@ -184,8 +192,8 @@ const PostsContainer = ({ className }) => {
dislikes: 1, dislikes: 1,
score: 4, score: 4,
}, },
isSeen: true, seen: true,
isArchived: false, archived: false,
type: "procedure-proposal", type: "procedure-proposal",
state: "rejected", state: "rejected",
}, },
...@@ -203,8 +211,8 @@ const PostsContainer = ({ className }) => { ...@@ -203,8 +211,8 @@ const PostsContainer = ({ className }) => {
dislikes: 1, dislikes: 1,
score: 4, score: 4,
}, },
isSeen: true, seen: true,
isArchived: true, archived: true,
type: "procedure-proposal", type: "procedure-proposal",
state: "rejected-by-chairman", state: "rejected-by-chairman",
}, },
......
declare namespace CF2021 { declare namespace CF2021 {
interface ProgramScheduleEntry {
id: string;
title: string;
expectedStartAt: Date;
expectedFinishAt: Date;
}
export interface ProgramStorePayload {
current: ProgramScheduleEntry & {
discussionOpened: boolean;
}
schedule: ProgramScheduleEntry[];
}
interface GroupMapping { interface GroupMapping {
id: number; id: number;
code: string; code: string;
...@@ -37,7 +51,7 @@ declare namespace CF2021 { ...@@ -37,7 +51,7 @@ declare namespace CF2021 {
content: string; content: string;
link?: string; link?: string;
relatedPostId: string; relatedPostId: string;
isSeen: boolean; seen: boolean;
} }
export interface AnnouncementStorePayload { export interface AnnouncementStorePayload {
...@@ -60,8 +74,15 @@ declare namespace CF2021 { ...@@ -60,8 +74,15 @@ declare namespace CF2021 {
likes: number; likes: number;
dislikes: number; dislikes: number;
}; };
isArchived: boolean; historyLog: {
isSeen: boolean; attribute: string;
newValue: string;
datetime: Date;
originator: "self" | "chairman";
}[];
archived: boolean;
hidden: boolean;
seen: boolean;
} }
export interface DiscussionPost extends AbstractPost { export interface DiscussionPost extends AbstractPost {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment