Skip to content

Commit

Permalink
adding required pages
Browse files Browse the repository at this point in the history
  • Loading branch information
IslemMedjahdi committed Jan 4, 2023
1 parent af7df3d commit f68bb13
Show file tree
Hide file tree
Showing 11 changed files with 117 additions and 10 deletions.
9 changes: 9 additions & 0 deletions src/components/add-announcement/AddAnnouncementIndex.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
const AddAnnouncementIndex = () => {
return (
<div className="flex justify-center">
<div className="container">AddAnnouncementIndex</div>
</div>
);
};

export default AddAnnouncementIndex;
22 changes: 16 additions & 6 deletions src/components/layout/header/ProfileMenu.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Menu, Transition } from "@headlessui/react";
import Link from "next/link";
import { Fragment } from "react";
import { ICONS } from "../../../constants/icons";
import { MENU_NAV } from "../../../constants/menuNav";
import { NAV } from "../../../constants/nav";
import { ROUTES } from "../../../constants/routes";
Expand Down Expand Up @@ -37,7 +38,7 @@ const ProfileMenu = () => {
<Menu.Item>
<Link
href={ROUTES.HOME.path}
className="flex items-center gap-x-2 px-3 py-2 text-sm font-medium hover:bg-gray-50 "
className="flex items-center gap-x-2 px-2 py-2 text-sm font-medium hover:bg-gray-50 "
>
<div>
<ProfileImage />
Expand All @@ -55,28 +56,37 @@ const ProfileMenu = () => {
{MENU_NAV.map((item, index) => (
<Menu.Item key={index}>
<Link
className="flex flex-wrap items-center gap-x-2 px-3 py-4 text-sm font-medium hover:bg-gray-50"
className="flex flex-wrap items-center gap-x-2 px-2 py-2 text-sm font-medium hover:bg-gray-50"
href={item.path}
>
{item.name}
<div className="flex h-10 w-10 items-center justify-center">
<item.Icon className="text-xl text-gray-700" />
</div>
<span> {item.name}</span>
</Link>
</Menu.Item>
))}
{NAV.map((item, index) => (
<Menu.Item key={index}>
<Link
className="flex flex-wrap items-center gap-x-2 px-2 py-4 text-sm font-medium hover:bg-gray-50 md:hidden "
className="flex flex-wrap items-center gap-x-2 px-2 py-2 text-sm font-medium hover:bg-gray-50 md:hidden "
href={item.path}
>
{item.name}
<div className="flex h-10 w-10 items-center justify-center">
<item.Icon className="text-xl text-gray-700" />
</div>
<span> {item.name}</span>
</Link>
</Menu.Item>
))}
<Menu.Item>
<div
onClick={signOut}
className="flex cursor-pointer flex-wrap items-center gap-x-2 px-2 py-4 text-sm font-medium hover:bg-gray-50"
className="flex cursor-pointer flex-wrap items-center gap-x-2 px-2 py-2 text-sm font-medium hover:bg-gray-50"
>
<div className="flex h-10 w-10 items-center justify-center">
<ICONS.SignOut className="text-xl text-gray-700" />
</div>
<p>Se déconnecter</p>
</div>
</Menu.Item>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
const PostedAnnouncementIndex: React.FC = () => {
return (
<div className="flex justify-center">
<div className="container">PostedAnnouncement</div>
</div>
);
};

export default PostedAnnouncementIndex;
12 changes: 12 additions & 0 deletions src/constants/icons.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
import {
BsBookmarkHeart,
BsEnvelope,
BsFolder,
BsGear,
BsPersonX,
} from "react-icons/bs";
import { FiMenu } from "react-icons/fi";

export const ICONS = {
MENU: FiMenu,
Envelope: BsEnvelope,
Favorite: BsBookmarkHeart,
Posted: BsFolder,
SignOut: BsPersonX,
Settings: BsGear,
};
2 changes: 1 addition & 1 deletion src/constants/menuNav.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
import { ROUTES } from "./routes";

export const MENU_NAV = [ROUTES.MESSAGES];
export const MENU_NAV = [ROUTES.MESSAGES, ROUTES.SETTINGS];
19 changes: 18 additions & 1 deletion src/constants/routes.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { ICONS } from "./icons";
import { ROLES } from "./roles";

export const ROUTES = {
AUTH: {
name: "auth",
name: "Auth",
path: "/auth",
pathname: "/auth",
allowedRoles: [] as ROLES[],
Expand All @@ -18,17 +19,33 @@ export const ROUTES = {
path: "/posted-announcements",
pathname: "/posted-announcements",
allowedRoles: [ROLES.USER],
Icon: ICONS.Posted,
},
ADD_ANNOUNCEMENTS: {
name: "Ajouter une annonce",
path: "/posted-announcements/create",
pathname: "/posted-announcements/create",
allowedRoles: [ROLES.USER],
},
FAVORITE_ANNOUNCEMENTS: {
name: "Annonces préférées",
path: "/favorite-announcements",
pathname: "/favorite-announcements",
allowedRoles: [ROLES.USER],
Icon: ICONS.Favorite,
},
MESSAGES: {
name: "Mes messages",
path: "/messages",
pathname: "/messages",
allowedRoles: [ROLES.USER],
Icon: ICONS.Envelope,
},
SETTINGS: {
name: "Paramètres",
path: "/settings",
pathname: "/settings",
allowedRoles: [ROLES.ADMIN, ROLES.USER],
Icon: ICONS.Settings,
},
};
3 changes: 2 additions & 1 deletion src/pages/auth.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@ import { NextPage } from "next";
import { NextSeo } from "next-seo";

import AuthIndex from "../components/auth/AuthIndex";
import { ROUTES } from "../constants/routes";

const Auth: NextPage = () => {
return (
<>
<NextSeo title="Auth" />
<NextSeo title={ROUTES.AUTH.name} />
<AuthIndex />
</>
);
Expand Down
3 changes: 2 additions & 1 deletion src/pages/index.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import { NextPage } from "next";
import { NextSeo } from "next-seo";
import { ROUTES } from "../constants/routes";

const Home: NextPage = () => {
return (
<>
<NextSeo title="Accueille" />
<NextSeo title={ROUTES.HOME.name} />
<div>This is home page</div>
</>
);
Expand Down
15 changes: 15 additions & 0 deletions src/pages/posted-announcements/create.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { NextPage } from "next";
import { NextSeo } from "next-seo";
import AddAnnouncementIndex from "../../components/add-announcement/AddAnnouncementIndex";
import { ROUTES } from "../../constants/routes";

const AddAnnouncement: NextPage = () => {
return (
<>
<NextSeo title={ROUTES.ADD_ANNOUNCEMENTS.name} />
<AddAnnouncementIndex />
</>
);
};

export default AddAnnouncement;
15 changes: 15 additions & 0 deletions src/pages/posted-announcements/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { NextPage } from "next";
import { NextSeo } from "next-seo";
import PostedAnnouncementIndex from "../../components/posted-announcement/PostedAnnouncementIndex";
import { ROUTES } from "../../constants/routes";

const PostedAnnouncements: NextPage = () => {
return (
<>
<NextSeo title={ROUTES.POSTED_ANNOUNCEMENTS.name} />
<PostedAnnouncementIndex />
</>
);
};

export default PostedAnnouncements;
18 changes: 18 additions & 0 deletions src/services/annoucement.service.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
//import axios from "../constants/axios";

class AnnouncementService {
private static instance: AnnouncementService;
public static getInstance(): AnnouncementService {
if (!this.instance) {
this.instance = new AnnouncementService();
}
return this.instance;
}
constructor() {
console.log("AnnouncementService constructor");
}

// here put all announcements requests
}

export default AnnouncementService;

0 comments on commit f68bb13

Please sign in to comment.