From f556f67db62a396e16523275d653d45d6fa62d47 Mon Sep 17 00:00:00 2001 From: Stepan Usatiuk Date: Sat, 16 Dec 2023 21:07:39 +0100 Subject: [PATCH] deleting posts --- client/src/Post.scss | 24 ++++++++++++++- client/src/Post.tsx | 29 ++++++++++++++++++- client/src/Profile.tsx | 8 +++-- client/src/actions.ts | 11 +++++-- client/src/api/Post.ts | 14 +++++++-- client/src/api/dto.ts | 6 ++++ client/src/api/utils.ts | 6 +++- .../y/server/controller/PostController.java | 13 +++++++++ .../y/server/security/WebSecurityConfig.java | 4 ++- 9 files changed, 105 insertions(+), 10 deletions(-) diff --git a/client/src/Post.scss b/client/src/Post.scss index 7646b78..e944445 100644 --- a/client/src/Post.scss +++ b/client/src/Post.scss @@ -11,9 +11,31 @@ word-wrap: anywhere; } - .createdDate { + .footer { margin-top: 0.3rem; font-size: 0.7rem; color: #A0A0A0; + + display: flex; + flex: auto; + width: 100%; + + .info { + flex-grow: 1; + align-self: start; + } + + .actions { + align-self: end; + button { + background: none; + border: none; + padding: 0; + text-decoration: none; + cursor: pointer; + color: inherit; + font-size: inherit; + } + } } } \ No newline at end of file diff --git a/client/src/Post.tsx b/client/src/Post.tsx index fc55ed4..2cf4f99 100644 --- a/client/src/Post.tsx +++ b/client/src/Post.tsx @@ -1,16 +1,43 @@ import "./Post.scss"; +import { Form } from "react-router-dom"; export function Post({ text, createdDate, + actions, + id, }: { text: string; createdDate: string; + actions: boolean; + id: number; }) { return (
{text} - {createdDate} +
+
+ {createdDate} +
+ {actions && ( +
+
+ + +
+
+ )} +
); } diff --git a/client/src/Profile.tsx b/client/src/Profile.tsx index e371aa4..c4536c9 100644 --- a/client/src/Profile.tsx +++ b/client/src/Profile.tsx @@ -9,7 +9,7 @@ export interface IProfileProps { self: boolean; } -export function Profile(props: IProfileProps) { +export function Profile({ self }: IProfileProps) { const loaderData = useLoaderData() as LoaderToType< typeof profileSelfLoader >; @@ -31,7 +31,9 @@ export function Profile(props: IProfileProps) {