From eaaba499ed3099d10156e82a26a0e988f7b2f1da Mon Sep 17 00:00:00 2001 From: ilyasBozdemir Date: Thu, 2 May 2024 17:00:50 +0300 Subject: [PATCH 1/2] addded favorite page, member dashboard index page, reading-list page --- .../src/frontend/constants/meSidebarItems.jsx | 23 ++++ .../src/frontend/pages/_app.jsx | 5 +- .../src/frontend/pages/me/favorites.jsx | 27 +++++ .../src/frontend/pages/me/index.jsx | 112 +++++++++++++++++- .../src/frontend/pages/me/reading-list.jsx | 27 +++++ 5 files changed, 186 insertions(+), 8 deletions(-) create mode 100644 LibraryTrackingApp/src/frontend/pages/me/favorites.jsx create mode 100644 LibraryTrackingApp/src/frontend/pages/me/reading-list.jsx diff --git a/LibraryTrackingApp/src/frontend/constants/meSidebarItems.jsx b/LibraryTrackingApp/src/frontend/constants/meSidebarItems.jsx index bcd1f68..b354ea3 100644 --- a/LibraryTrackingApp/src/frontend/constants/meSidebarItems.jsx +++ b/LibraryTrackingApp/src/frontend/constants/meSidebarItems.jsx @@ -3,12 +3,21 @@ import { FaClock, FaExchangeAlt, FaHistory, + FaList, FaQuestionCircle, + FaStar, FaUser, FaUsers, } from "react-icons/fa"; +import { FiHome } from "react-icons/fi"; export const meSidebarItems = [ + { + title: "Ana Sayfa", + icon: , + href: "/me", + target: "_self", + }, { title: "Profil Yönetimi", icon: , @@ -37,6 +46,20 @@ export const meSidebarItems = [ target: "_self", subItems: [], }, + { + title: "Favoriler", + icon: , + href: "/me/favorites", + target: "_self", + subItems: [], + }, + { + title: "Okuma Listesi", + icon: , + href: "/me/reading-list", + target: "_self", + subItems: [], + }, { title: "Destek", icon: , diff --git a/LibraryTrackingApp/src/frontend/pages/_app.jsx b/LibraryTrackingApp/src/frontend/pages/_app.jsx index fbf41b3..390df02 100644 --- a/LibraryTrackingApp/src/frontend/pages/_app.jsx +++ b/LibraryTrackingApp/src/frontend/pages/_app.jsx @@ -3,13 +3,12 @@ import dynamic from "next/dynamic"; const AnonLayout = dynamic(() => import("@/layouts/Anon/layout")); const AppLayout = dynamic(() => import("@/layouts/App/layout")); +const MeLayout = dynamic(() => import("@/layouts/Me/layout")); const AdminLayout = dynamic(() => import("@/layouts/Admin/layout")); const PlaceholderLayout = dynamic(() => import("@/layouts/Placeholder/layout") ); - - import { useColorMode, colorMode } from "@chakra-ui/react"; import "../styles/globals.css"; @@ -33,10 +32,12 @@ function MyApp({ Component, pageProps, session, statusCode }) { const anonLayoutRoutes = ["/./"]; const adminLayoutRoutes = /^\/admin(?:\/|$)/; const appLayoutRoutes = /^\/app(?:\/|$)/; + const meLayoutRoutes = /^\/me(?:\/|$)/; const routeLayoutMap = [ { regex: adminLayoutRoutes, layout: AdminLayout }, { regex: appLayoutRoutes, layout: AppLayout }, + { regex: meLayoutRoutes, layout: MeLayout }, { regex: new RegExp(`^(${placeholderRoutes.join("|")})`), layout: PlaceholderLayout, diff --git a/LibraryTrackingApp/src/frontend/pages/me/favorites.jsx b/LibraryTrackingApp/src/frontend/pages/me/favorites.jsx new file mode 100644 index 0000000..9af45d5 --- /dev/null +++ b/LibraryTrackingApp/src/frontend/pages/me/favorites.jsx @@ -0,0 +1,27 @@ +import React from "react"; +import { Container, Heading, List, ListItem, Text } from "@chakra-ui/react"; + +const FavoritesPage = () => { + const favorites = [ + { id: 1, title: "Harry Potter and the Philosopher's Stone", author: "J.K. Rowling" }, + { id: 2, title: "To Kill a Mockingbird", author: "Harper Lee" }, + { id: 3, title: "1984", author: "George Orwell" }, + + ]; + + return ( + + Favoriler + + {favorites.map((item) => ( + + {item.title} + {item.author} + + ))} + + + ); +}; + +export default FavoritesPage; diff --git a/LibraryTrackingApp/src/frontend/pages/me/index.jsx b/LibraryTrackingApp/src/frontend/pages/me/index.jsx index 732ec8b..270def9 100644 --- a/LibraryTrackingApp/src/frontend/pages/me/index.jsx +++ b/LibraryTrackingApp/src/frontend/pages/me/index.jsx @@ -1,9 +1,109 @@ -import React from 'react' +import React from "react"; + +import { + Flex, + Box, + Heading, + Text, + Button, + IconButton, + Spacer, + Stack, + Divider, + Avatar, + AvatarBadge, + HStack, +} from "@chakra-ui/react"; +import { FiSettings, FiLogOut } from "react-icons/fi"; +import { FaRegHeart, FaRegListAlt } from "react-icons/fa"; + +const IndexPage = () => { + + const user = { + name: "İlyas Bozdemir", + username: "İlyas Bozdemir", + email: "user@example.com", + avatar: "https://avatars.githubusercontent.com/u/52322835?s=96&v=4", + role: "Üye", + status: "Aktif", + bio: "Merhaba, ben İlyas. Kitap okumayı çok seviyorum ve bu platformda yeni kitaplar keşfetmeyi umuyorum.", + }; -function IndexPage() { return ( -
IndexPage
- ) -} + + + + + + + {user.username} + + Premium Üye + + + } + colorScheme="red" + /> + + + + + + + Favori Kitaplar + + + + 1. Harry Potter ve Felsefe Taşı + J.K. Rowling + + + + 2. Hobbit + J.R.R. Tolkien + + + + 3. Suç ve Ceza + Fyodor Dostoyevski + + + + + + + + Okuma Listesi + + + + 1. Uyanış + Leo Tolstoy + + + + 2. 1984 + George Orwell + + + + 3. Uçurtma Avcısı + Khaled Hosseini + + + + + + ); +}; -export default IndexPage \ No newline at end of file +export default IndexPage; diff --git a/LibraryTrackingApp/src/frontend/pages/me/reading-list.jsx b/LibraryTrackingApp/src/frontend/pages/me/reading-list.jsx new file mode 100644 index 0000000..4600256 --- /dev/null +++ b/LibraryTrackingApp/src/frontend/pages/me/reading-list.jsx @@ -0,0 +1,27 @@ +import React from "react"; +import { Container, Heading, List, ListItem, Text } from "@chakra-ui/react"; + +const ReadingListPage = () => { + const readingList = [ + { id: 1, title: "The Great Gatsby", author: "F. Scott Fitzgerald" }, + { id: 2, title: "Pride and Prejudice", author: "Jane Austen" }, + { id: 3, title: "The Catcher in the Rye", author: "J.D. Salinger" }, + + ]; + + return ( + + Okuma Listesi + + {readingList.map((item) => ( + + {item.title} + {item.author} + + ))} + + + ); +}; + +export default ReadingListPage; From 0a3194e6b17503da24b1376f4901f79aaaf6dbb9 Mon Sep 17 00:00:00 2001 From: ilyasBozdemir Date: Thu, 2 May 2024 22:22:05 +0300 Subject: [PATCH 2/2] updated --- .../DataTransferObjects/AuthorDTO.cs | 1 + .../DataTransferObjects/CreateAuthorDTO.cs | 1 + .../Commands/Handlers/CreateAuthorCommandHandler.cs | 10 ++-------- .../Commands/Requests/CreateAuthorCommandRequest.cs | 1 + .../Queries/Handlers/GetAllAuthorsQueryHandler.cs | 1 + .../src/frontend/constants/appSidebarItems.jsx | 4 ++-- 6 files changed, 8 insertions(+), 10 deletions(-) diff --git a/LibraryTrackingApp/src/backend/Core/LibraryTrackingApp.Application/DataTransferObjects/AuthorDTO.cs b/LibraryTrackingApp/src/backend/Core/LibraryTrackingApp.Application/DataTransferObjects/AuthorDTO.cs index 1ab6d97..0a8afbd 100644 --- a/LibraryTrackingApp/src/backend/Core/LibraryTrackingApp.Application/DataTransferObjects/AuthorDTO.cs +++ b/LibraryTrackingApp/src/backend/Core/LibraryTrackingApp.Application/DataTransferObjects/AuthorDTO.cs @@ -8,4 +8,5 @@ public record AuthorDTO : BaseAuditableDTO public DateTime BirthDate { get; set; } public string Country { get; set; } public string Biography { get; set; } + public string Website { get; set; } } diff --git a/LibraryTrackingApp/src/backend/Core/LibraryTrackingApp.Application/DataTransferObjects/CreateAuthorDTO.cs b/LibraryTrackingApp/src/backend/Core/LibraryTrackingApp.Application/DataTransferObjects/CreateAuthorDTO.cs index 2a4e3ed..fe5a1e2 100644 --- a/LibraryTrackingApp/src/backend/Core/LibraryTrackingApp.Application/DataTransferObjects/CreateAuthorDTO.cs +++ b/LibraryTrackingApp/src/backend/Core/LibraryTrackingApp.Application/DataTransferObjects/CreateAuthorDTO.cs @@ -7,4 +7,5 @@ public record CreateAuthorDTO : BaseAuditableDTO public DateTime BirthDate { get; set; } public string Country { get; set; } public string Biography { get; set; } + public string Website { get; set; } } diff --git a/LibraryTrackingApp/src/backend/Core/LibraryTrackingApp.Application/Features/Authors/Commands/Handlers/CreateAuthorCommandHandler.cs b/LibraryTrackingApp/src/backend/Core/LibraryTrackingApp.Application/Features/Authors/Commands/Handlers/CreateAuthorCommandHandler.cs index 426d2f7..8600f99 100644 --- a/LibraryTrackingApp/src/backend/Core/LibraryTrackingApp.Application/Features/Authors/Commands/Handlers/CreateAuthorCommandHandler.cs +++ b/LibraryTrackingApp/src/backend/Core/LibraryTrackingApp.Application/Features/Authors/Commands/Handlers/CreateAuthorCommandHandler.cs @@ -47,6 +47,7 @@ public async Task Handle(CreateAuthorCommandRequest Country = request.Country, BirthDate = request.BirthDate, Biography = request.Biography, + Website = request.Website, IsDeleted = false, CreatedById = Guid.NewGuid(),//staff id olucak ilerde LastModifiedById = Guid.NewGuid(),//staff id olucak ilerde @@ -54,14 +55,7 @@ public async Task Handle(CreateAuthorCommandRequest CreatedDateUnix = BaseEntity.ToUnixTimestamp(DateTime.Now), }; - var bookDto = new AuthorDTO() - { - Name = request.Name, - Surname = request.Surname, - Country = request.Country, - BirthDate = request.BirthDate, - Biography = request.Biography, - }; + var writeRepository = _unitOfWork.GetWriteRepository(); bool isAdded = await writeRepository.AddAsync(newAuthor); diff --git a/LibraryTrackingApp/src/backend/Core/LibraryTrackingApp.Application/Features/Authors/Commands/Requests/CreateAuthorCommandRequest.cs b/LibraryTrackingApp/src/backend/Core/LibraryTrackingApp.Application/Features/Authors/Commands/Requests/CreateAuthorCommandRequest.cs index 1b7b4c9..ff05e7d 100644 --- a/LibraryTrackingApp/src/backend/Core/LibraryTrackingApp.Application/Features/Authors/Commands/Requests/CreateAuthorCommandRequest.cs +++ b/LibraryTrackingApp/src/backend/Core/LibraryTrackingApp.Application/Features/Authors/Commands/Requests/CreateAuthorCommandRequest.cs @@ -9,4 +9,5 @@ public class CreateAuthorCommandRequest : IRequest public DateTime BirthDate { get; set; } public string Country { get; set; } public string Biography { get; set; } + public string Website { get; set; } } diff --git a/LibraryTrackingApp/src/backend/Core/LibraryTrackingApp.Application/Features/Authors/Queries/Handlers/GetAllAuthorsQueryHandler.cs b/LibraryTrackingApp/src/backend/Core/LibraryTrackingApp.Application/Features/Authors/Queries/Handlers/GetAllAuthorsQueryHandler.cs index bfed1be..7d52090 100644 --- a/LibraryTrackingApp/src/backend/Core/LibraryTrackingApp.Application/Features/Authors/Queries/Handlers/GetAllAuthorsQueryHandler.cs +++ b/LibraryTrackingApp/src/backend/Core/LibraryTrackingApp.Application/Features/Authors/Queries/Handlers/GetAllAuthorsQueryHandler.cs @@ -64,6 +64,7 @@ bunlar her handler'de kullanılcaktır. Biography = author.Biography, BirthDate = author.BirthDate, Country = author.Country, + Website=author.Website, }).ToList(); _cache.Set(cacheKey, authorDtoList, TimeSpan.FromMinutes(5)); diff --git a/LibraryTrackingApp/src/frontend/constants/appSidebarItems.jsx b/LibraryTrackingApp/src/frontend/constants/appSidebarItems.jsx index 43de737..67b83b7 100644 --- a/LibraryTrackingApp/src/frontend/constants/appSidebarItems.jsx +++ b/LibraryTrackingApp/src/frontend/constants/appSidebarItems.jsx @@ -229,13 +229,13 @@ export const sidebarItems = [ { icon: , title: "Yeni Ekle", - href: "book-tag/new", + href: "/app/book-tag/new", target: "_self", }, { icon: , title: "Etiketleri Listele", - href: "book-tag", + href: "/app/book-tag", target: "_self", }, ],