From 4fb3bcde94b0ce1cb1a53faa938af578957fa710 Mon Sep 17 00:00:00 2001 From: Maciej Krawczyk <63869461+wzarek@users.noreply.github.com> Date: Sun, 23 Jun 2024 01:11:03 +0200 Subject: [PATCH] feat: implemented event browse page --- .../apps/web/app/events/[slug]/edit/page.tsx | 24 +-- .../apps/web/app/events/layout.tsx | 6 +- .../apps/web/app/events/new/page.tsx | 21 +-- .../reasn-client/apps/web/app/events/page.tsx | 148 ++++++++++++++++++ .../reasn-client/apps/web/tailwind.config.js | 6 +- .../common/{ => src}/helpers/uiHelpers.ts | 2 +- .../ui/src/components/shared/Card.tsx | 2 + .../ui/src/components/shared/Comment.tsx | 5 +- .../src/components/shared/form/Dropdown.tsx | 6 +- .../src/components/web/main/QuickFilters.tsx | 2 +- .../packages/ui/tailwind.config.js | 6 +- 11 files changed, 196 insertions(+), 32 deletions(-) create mode 100644 Client/reasn-client/apps/web/app/events/page.tsx rename Client/reasn-client/packages/common/{ => src}/helpers/uiHelpers.ts (89%) diff --git a/Client/reasn-client/apps/web/app/events/[slug]/edit/page.tsx b/Client/reasn-client/apps/web/app/events/[slug]/edit/page.tsx index 963aeb45..cd27ed6e 100644 --- a/Client/reasn-client/apps/web/app/events/[slug]/edit/page.tsx +++ b/Client/reasn-client/apps/web/app/events/[slug]/edit/page.tsx @@ -12,9 +12,9 @@ import { ChangeEvent, useState } from "react"; import { ArrowLeft, Clock, Location, Upload } from "@reasn/ui/src/icons"; import { useRouter } from "next/navigation"; import clsx from "clsx"; -import { EventStatus } from "@reasn/common/enums/modelsEnums"; +import { EventStatus } from "@reasn/common/src/enums/schemasEnums"; import { BaseInput } from "@reasn/ui/src/components/shared/form/Input"; -import { getStatusClass } from "@reasn/common/helpers/uiHelpers"; +import { getStatusClass } from "@reasn/common/src/helpers/uiHelpers"; const IMAGES = [ "https://images.pexels.com/photos/19012544/pexels-photo-19012544/free-photo-of-storm.jpeg?auto=compress&cs=tinysrgb&w=1260&h=750&dpr=1", @@ -28,7 +28,7 @@ const IMAGES = [ "https://images.pexels.com/photos/54332/currant-immature-bush-berry-54332.jpeg?auto=compress&cs=tinysrgb&w=1260&h=750&dpr=1", ]; -const MOCK_TAGS = [ +export const MOCK_TAGS = [ "abcd", "efgh", "ijkl", @@ -155,7 +155,7 @@ const EventEditPage = ({ params }: { params: { slug: string } }) => { /> )} -
+
{
-

Dodatkowe informacje:

- +

Dodatkowe informacje:

+
+ +

Wybrane parametry:

{paramsKeys?.map((key, idx) => ( diff --git a/Client/reasn-client/apps/web/app/events/layout.tsx b/Client/reasn-client/apps/web/app/events/layout.tsx index c9ac1139..d6bb544c 100644 --- a/Client/reasn-client/apps/web/app/events/layout.tsx +++ b/Client/reasn-client/apps/web/app/events/layout.tsx @@ -1,6 +1,6 @@ import React from "react"; -const EventLayout = ({ +const EventsLayout = ({ children, params, }: { @@ -11,10 +11,10 @@ const EventLayout = ({ }; }) => { return ( -
+
{children}
); }; -export default EventLayout; +export default EventsLayout; diff --git a/Client/reasn-client/apps/web/app/events/new/page.tsx b/Client/reasn-client/apps/web/app/events/new/page.tsx index f21f820b..1ed95c4c 100644 --- a/Client/reasn-client/apps/web/app/events/new/page.tsx +++ b/Client/reasn-client/apps/web/app/events/new/page.tsx @@ -8,11 +8,10 @@ import { } from "@reasn/ui/src/components/shared/form"; import { ChangeEvent, useState } from "react"; import { Clock, Location, Upload } from "@reasn/ui/src/icons"; -import { useRouter } from "next/navigation"; import clsx from "clsx"; -import { EventStatus } from "@reasn/common/enums/modelsEnums"; +import { EventStatus } from "@reasn/common/src/enums/schemasEnums"; import { BaseInput } from "@reasn/ui/src/components/shared/form/Input"; -import { getStatusClass } from "@reasn/common/helpers/uiHelpers"; +import { getStatusClass } from "@reasn/common/src/helpers/uiHelpers"; const MOCK_TAGS = [ "abcd", @@ -94,7 +93,7 @@ const EventAddPage = () => { > {status}

-
+
{

Dodatkowe informacje:

- +
+ +

Wybrane parametry:

{!paramsKeys || diff --git a/Client/reasn-client/apps/web/app/events/page.tsx b/Client/reasn-client/apps/web/app/events/page.tsx new file mode 100644 index 00000000..70808736 --- /dev/null +++ b/Client/reasn-client/apps/web/app/events/page.tsx @@ -0,0 +1,148 @@ +"use client"; + +import { EventStatus } from "@reasn/common/src/enums/schemasEnums"; +import { Card, CardVariant } from "@reasn/ui/src/components/shared"; +import { + FloatingInput, + SearchMultiDropdown, + SingleDropdown, +} from "@reasn/ui/src/components/shared/form"; +import { ArrowLeft, ArrowRight, Clock } from "@reasn/ui/src/icons"; +import { useState } from "react"; +import { MOCK_TAGS } from "./[slug]/edit/page"; +import clsx from "clsx"; + +const EventsPage = () => { + const [selectedSortBy, setSelectedSortBy] = useState("tytuł"); + const [selectedSortOrder, setSelectedSortOrder] = useState("rosnąco"); + const [selectedStatus, setSelectedStatus] = useState("wszystkie"); + const [selectViewMode, setSelectViewMode] = useState("kafelki"); + const [tags, setTags] = useState(MOCK_TAGS.slice(0, 5)); + const [selectedPage, setSelectedPage] = useState(1); + const cardVariant = + selectViewMode === "kafelki" ? CardVariant.Tile : CardVariant.List; + + return ( +
+
+

+ Wydarzenia +

+
+
+

Filtry:

+
+ +
+
+ + +
+
+ + +
+
+

Status:

+ +
+
+ +
+
+
+
+
+

widok:

+ +
+
+

sortowanie:

+ + +
+
+
+ {[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11].map((idx) => ( + + ))} +
+
+ {selectedPage > 1 && ( + setSelectedPage(selectedPage - 1)} + /> + )} + {[1, 2, 3].map((idx) => ( +

+ {idx} +

+ ))} + {selectedPage < 3 && ( + setSelectedPage(selectedPage + 1)} + /> + )} +
+
+
+
+ ); +}; + +export default EventsPage; diff --git a/Client/reasn-client/apps/web/tailwind.config.js b/Client/reasn-client/apps/web/tailwind.config.js index ef1ecc98..6ca42768 100644 --- a/Client/reasn-client/apps/web/tailwind.config.js +++ b/Client/reasn-client/apps/web/tailwind.config.js @@ -8,7 +8,11 @@ module.exports = { "../../packages/ui/src/**/*.{js,jsx,ts,tsx}", ], theme: { - extend: {}, + extend: { + screens: { + xs: "460px", + }, + }, }, plugins: [], }; diff --git a/Client/reasn-client/packages/common/helpers/uiHelpers.ts b/Client/reasn-client/packages/common/src/helpers/uiHelpers.ts similarity index 89% rename from Client/reasn-client/packages/common/helpers/uiHelpers.ts rename to Client/reasn-client/packages/common/src/helpers/uiHelpers.ts index 9978becc..e34ce1ad 100644 --- a/Client/reasn-client/packages/common/helpers/uiHelpers.ts +++ b/Client/reasn-client/packages/common/src/helpers/uiHelpers.ts @@ -1,4 +1,4 @@ -import { EventStatus } from "@reasn/common/enums/modelsEnums"; +import { EventStatus } from "@reasn/common/src/enums/schemasEnums"; export const getStatusClass = (status: EventStatus) => { switch (status) { diff --git a/Client/reasn-client/packages/ui/src/components/shared/Card.tsx b/Client/reasn-client/packages/ui/src/components/shared/Card.tsx index 56b8ca47..73a92e01 100644 --- a/Client/reasn-client/packages/ui/src/components/shared/Card.tsx +++ b/Client/reasn-client/packages/ui/src/components/shared/Card.tsx @@ -1,3 +1,5 @@ +"use client"; + import React from "react"; import { useRouter } from "next/navigation"; diff --git a/Client/reasn-client/packages/ui/src/components/shared/Comment.tsx b/Client/reasn-client/packages/ui/src/components/shared/Comment.tsx index f10838a2..c2bceb92 100644 --- a/Client/reasn-client/packages/ui/src/components/shared/Comment.tsx +++ b/Client/reasn-client/packages/ui/src/components/shared/Comment.tsx @@ -1,5 +1,8 @@ import React from "react"; -import { CommentDto, CommentDtoMapper } from "@reasn/common/models/CommentDto"; +import { + CommentDto, + CommentDtoMapper, +} from "@reasn/common/src/schemas/CommentDto"; interface CommentProps { comment: CommentDto; diff --git a/Client/reasn-client/packages/ui/src/components/shared/form/Dropdown.tsx b/Client/reasn-client/packages/ui/src/components/shared/form/Dropdown.tsx index c35de5ab..834786de 100644 --- a/Client/reasn-client/packages/ui/src/components/shared/form/Dropdown.tsx +++ b/Client/reasn-client/packages/ui/src/components/shared/form/Dropdown.tsx @@ -41,7 +41,7 @@ export const SearchMultiDropdown = (props: MultiDropdownProps) => { }; return ( -
+
{ >
@@ -132,7 +132,7 @@ export const SingleDropdown = (props: SingleDropdownProps) => {
{ selected={selectedFilter === "Remote"} />
-
+
diff --git a/Client/reasn-client/packages/ui/tailwind.config.js b/Client/reasn-client/packages/ui/tailwind.config.js index 37cc6514..54061748 100644 --- a/Client/reasn-client/packages/ui/tailwind.config.js +++ b/Client/reasn-client/packages/ui/tailwind.config.js @@ -2,7 +2,11 @@ module.exports = { content: ["./src/**/*.{js,jsx,ts,tsx}"], theme: { - extend: {}, + extend: { + screens: { + xs: "460px", + }, + }, }, plugins: [], };