diff --git a/src/components/annoucements/Announcement.jsx b/src/components/annoucements/Announcement.jsx index 03e0c3956f4c7be18f7403eeb67eb98193f816d9..39b769b8b62e16aef917a7f8df92c54dfd4c8d89 100644 --- a/src/components/annoucements/Announcement.jsx +++ b/src/components/annoucements/Announcement.jsx @@ -11,13 +11,13 @@ const Announcement = ({ content, link, relatedPostId, - isSeen, + seen, }) => { const wrapperClassName = classNames( "bg-opacity-50 border-l-2 px-4 py-2 lg:px-8 lg:py-3", { - "bg-grey-50": isSeen, - "bg-yellow-100": !isSeen, + "bg-grey-50": !!seen, + "bg-yellow-100": !seen, "border-orange-300": type === "rejected-procedure-proposal", "border-blue-300": type === "suggested-procedure-proposal", "border-green-400": type === "accepted-procedure-proposal", diff --git a/src/components/annoucements/AnnouncementList.jsx b/src/components/annoucements/AnnouncementList.jsx index 7d4dbd20d33ee9e1bdcb1618401f90d8a3cdeef0..7698f6c749bcfa273becc72be9f9c12307ec3833 100644 --- a/src/components/annoucements/AnnouncementList.jsx +++ b/src/components/annoucements/AnnouncementList.jsx @@ -13,7 +13,7 @@ const AnnouncementList = ({ items, className }) => { type={item.type} content={item.content} link={item.link} - isSeen={item.isSeen} + seen={item.seen} /> ))} </div> diff --git a/src/components/posts/Post.jsx b/src/components/posts/Post.jsx index a85ca959b633030210a0962f32dd71c89e3c46bd..2e8a892e5a27d66ecd0e322aeb18b380fe1165b4 100644 --- a/src/components/posts/Post.jsx +++ b/src/components/posts/Post.jsx @@ -11,16 +11,16 @@ const Post = ({ type, ranking, content, - isSeen, - isArchived, + seen, + archived, state, - originalContent, + historyLog, }) => { const wrapperClassName = classNames( "flex items-start p-4 lg:p-2 lg:py-4 lg:-mx-2", { - "bg-yellow-100 bg-opacity-50": !isSeen, - "opacity-25 hover:opacity-100 transition-opacity duration-200": isArchived, + "bg-yellow-100 bg-opacity-50": !seen, + "opacity-25 hover:opacity-100 transition-opacity duration-200": !!archived, }, className ); @@ -78,7 +78,7 @@ const Post = ({ ); } - if (isArchived) { + if (archived) { labels.push( <Chip key="isArchived" @@ -91,6 +91,12 @@ const Post = ({ ); } + const isModified = + (historyLog || []).filter( + (logRecord) => + logRecord.attribute === "content" && logRecord.originator === "chairman" + ).length > 0; + return ( <div className={wrapperClassName}> <img @@ -108,6 +114,11 @@ const Post = ({ <span className="text-grey-200 text-sm">{author.group}</span> <span className="text-grey-200 ml-1 text-sm"> @ {format(datetime, "H:mm")} + {isModified && ( + <span className="text-grey-200 text-xs ml-2 underline"> + (Upraveno pĹ™esdedajĂcĂm) + </span> + )} </span> </div> </div> diff --git a/src/components/posts/PostList.jsx b/src/components/posts/PostList.jsx index 8a2ee972e6b0fb2be2523f0828c59a64c5b5fdf9..efdb9ccc332f773edeb11c8efd9211a02508f261 100644 --- a/src/components/posts/PostList.jsx +++ b/src/components/posts/PostList.jsx @@ -6,20 +6,22 @@ import Post from "./Post"; const PostList = ({ className, items }) => { return ( <div className={classNames("space-y-px", className)}> - {items.map((item) => ( - <Post - key={item.id} - datetime={item.datetime} - author={item.author} - type={item.type} - state={item.state} - content={item.content} - originalContent={item.originalContent} - ranking={item.ranking} - isSeen={item.isSeen} - isArchived={item.isArchived} - /> - ))} + {items + .filter((item) => !item.hidden) + .map((item) => ( + <Post + key={item.id} + datetime={item.datetime} + author={item.author} + type={item.type} + state={item.state} + content={item.content} + ranking={item.ranking} + historyLog={item.historyLog} + seen={item.seen} + archived={item.archived} + /> + ))} </div> ); }; diff --git a/src/containers/AnnoucementsContainer.jsx b/src/containers/AnnoucementsContainer.jsx index 4c592d1e7193a01fcddad433029d86eee7c726ad..f75e8ff0efee520f418ef2cac24116670adbf1c5 100644 --- a/src/containers/AnnoucementsContainer.jsx +++ b/src/containers/AnnoucementsContainer.jsx @@ -10,7 +10,7 @@ const AnnoucementsContainer = () => { content: "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(), - isSeen: false, + seen: false, type: "rejected-procedure-proposal", }, { @@ -18,7 +18,7 @@ const AnnoucementsContainer = () => { content: "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(), - isSeen: false, + seen: false, type: "accepted-procedure-proposal", }, { @@ -26,7 +26,7 @@ const AnnoucementsContainer = () => { content: "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(), - isSeen: true, + seen: true, type: "suggested-procedure-proposal", }, { @@ -34,7 +34,7 @@ const AnnoucementsContainer = () => { content: "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(), - isSeen: true, + seen: true, type: "voting", }, { @@ -42,7 +42,7 @@ const AnnoucementsContainer = () => { content: "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(), - isSeen: true, + seen: true, type: "announcement", }, { @@ -50,7 +50,7 @@ const AnnoucementsContainer = () => { content: "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(), - isSeen: true, + seen: true, type: "user-ban", }, ]; diff --git a/src/containers/PostsContainer.jsx b/src/containers/PostsContainer.jsx index e7dd22cf6a93ca727196d680cd002938c3db8f88..caeea1740f1456a8cff25338f746166ca8f5a058 100644 --- a/src/containers/PostsContainer.jsx +++ b/src/containers/PostsContainer.jsx @@ -19,8 +19,8 @@ const PostsContainer = ({ className }) => { dislikes: 1, score: 4, }, - isSeen: false, - isArchived: false, + seen: false, + archived: false, type: "post", }, { @@ -37,8 +37,8 @@ const PostsContainer = ({ className }) => { dislikes: 1, score: 4, }, - isSeen: false, - isArchived: false, + seen: false, + archived: false, type: "post", }, { @@ -55,8 +55,8 @@ const PostsContainer = ({ className }) => { dislikes: 1, score: 4, }, - isSeen: true, - isArchived: false, + seen: true, + archived: false, type: "post", }, { @@ -73,8 +73,8 @@ const PostsContainer = ({ className }) => { dislikes: 1, score: 4, }, - isSeen: true, - isArchived: false, + seen: true, + archived: false, type: "post", }, { @@ -91,8 +91,8 @@ const PostsContainer = ({ className }) => { dislikes: 1, score: 4, }, - isSeen: true, - isArchived: false, + seen: true, + archived: false, type: "post", }, { @@ -109,8 +109,8 @@ const PostsContainer = ({ className }) => { dislikes: 1, score: 4, }, - isSeen: true, - isArchived: true, + seen: true, + archived: true, type: "post", }, { @@ -127,8 +127,8 @@ const PostsContainer = ({ className }) => { dislikes: 1, score: 4, }, - isSeen: true, - isArchived: true, + seen: true, + archived: true, type: "procedure-proposal", state: "pending", }, @@ -146,10 +146,18 @@ const PostsContainer = ({ className }) => { dislikes: 1, score: 4, }, - isSeen: true, - isArchived: false, + seen: true, + archived: false, type: "procedure-proposal", state: "announced", + historyLog: [ + { + attribute: "content", + datetime: new Date(), + newValue: "Lemme know", + originator: "chairman", + }, + ], }, { id: "9", @@ -165,8 +173,8 @@ const PostsContainer = ({ className }) => { dislikes: 1, score: 4, }, - isSeen: true, - isArchived: false, + seen: true, + archived: false, type: "procedure-proposal", state: "accepted", }, @@ -184,8 +192,8 @@ const PostsContainer = ({ className }) => { dislikes: 1, score: 4, }, - isSeen: true, - isArchived: false, + seen: true, + archived: false, type: "procedure-proposal", state: "rejected", }, @@ -203,8 +211,8 @@ const PostsContainer = ({ className }) => { dislikes: 1, score: 4, }, - isSeen: true, - isArchived: true, + seen: true, + archived: true, type: "procedure-proposal", state: "rejected-by-chairman", }, diff --git a/typings/cf2021.d.ts b/typings/cf2021.d.ts index 4dd762b6e080350c0db9f41e2c6fd1ce2a83d20e..5df54146d88029a954d035d05bdfa30f26ca75f5 100644 --- a/typings/cf2021.d.ts +++ b/typings/cf2021.d.ts @@ -1,4 +1,18 @@ declare namespace CF2021 { + interface ProgramScheduleEntry { + id: string; + title: string; + expectedStartAt: Date; + expectedFinishAt: Date; + } + + export interface ProgramStorePayload { + current: ProgramScheduleEntry & { + discussionOpened: boolean; + } + schedule: ProgramScheduleEntry[]; + } + interface GroupMapping { id: number; code: string; @@ -37,7 +51,7 @@ declare namespace CF2021 { content: string; link?: string; relatedPostId: string; - isSeen: boolean; + seen: boolean; } export interface AnnouncementStorePayload { @@ -60,8 +74,15 @@ declare namespace CF2021 { likes: number; dislikes: number; }; - isArchived: boolean; - isSeen: boolean; + historyLog: { + attribute: string; + newValue: string; + datetime: Date; + originator: "self" | "chairman"; + }[]; + archived: boolean; + hidden: boolean; + seen: boolean; } export interface DiscussionPost extends AbstractPost {