Skip to content

Commit

Permalink
handle no announcement
Browse files Browse the repository at this point in the history
  • Loading branch information
IslemMedjahdi committed Jan 5, 2023
1 parent 274885d commit 94f3dcf
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 6 deletions.
19 changes: 16 additions & 3 deletions src/components/posted-announcement/PostedAnnouncementIndex.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -161,10 +161,9 @@ const PostedAnnouncementIndex: React.FC = () => {
try {
const response = await announcementService.getMyAnnouncements();
setAnnouncements(response.data);
setLoading(false);
} catch (e) {
console.log(e);
} finally {
setLoading(false);
}
};

Expand All @@ -184,6 +183,20 @@ const PostedAnnouncementIndex: React.FC = () => {
<DataTable
columns={columns}
data={announcements || []}
noDataComponent={
<div className="flex h-52 flex-col items-center justify-center gap-2">
<p className="text-center text-lg font-medium text-gray-800">
Vous n'avez pas encore d'annonce, cliquez ici pour ajouter une
nouvelle annonce
</p>
<Link
href={ROUTES.ADD_ANNOUNCEMENT.path}
className="rounded-sm bg-blue-primary px-4 py-2 text-white transition duration-200 hover:bg-blue-hover"
>
Ajouter une announce
</Link>
</div>
}
customStyles={{
headCells: {
style: {
Expand All @@ -195,7 +208,7 @@ const PostedAnnouncementIndex: React.FC = () => {
pagination
progressPending={loading}
progressComponent={
<div className="flex w-full justify-center dark:bg-slate-800">
<div className="flex h-52 w-full items-center justify-center dark:bg-slate-800">
<Loading />
</div>
}
Expand Down
2 changes: 1 addition & 1 deletion src/constants/info.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { IMAGES } from "./images";

export const INFO = {
Title: "Future Immobilier",
Title: "Immobilia",
Icon: IMAGES.Logo,
Description: "",
};
2 changes: 1 addition & 1 deletion src/constants/routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export const ROUTES = {
allowedRoles: [ROLES.USER],
Icon: ICONS.Posted,
},
ADD_ANNOUNCEMENTS: {
ADD_ANNOUNCEMENT: {
name: "Ajouter une annonce",
path: "/posted-announcements/create",
pathname: "/posted-announcements/create",
Expand Down
2 changes: 1 addition & 1 deletion src/pages/posted-announcements/create.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { ROUTES } from "../../constants/routes";
const AddAnnouncement: NextPage = () => {
return (
<>
<NextSeo title={ROUTES.ADD_ANNOUNCEMENTS.name} />
<NextSeo title={ROUTES.ADD_ANNOUNCEMENT.name} />
<AddAnnouncementIndex />
</>
);
Expand Down

0 comments on commit 94f3dcf

Please sign in to comment.