From 25bfb8c698a29dcac3a10cea3f4a548d5f90f4ee Mon Sep 17 00:00:00 2001 From: mbappai Date: Thu, 21 Sep 2023 07:08:25 +0100 Subject: [PATCH 1/5] refactor: use correct link for private events --- pages/organizations/events/index.tsx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pages/organizations/events/index.tsx b/pages/organizations/events/index.tsx index 372d58a3..ef205780 100644 --- a/pages/organizations/events/index.tsx +++ b/pages/organizations/events/index.tsx @@ -191,8 +191,8 @@ function gotoEventPage(event:Event){ }, { title: 'Type', - dataIndex: 'eventType', - key: 'eventType', + dataIndex: 'type', + key: 'type', width:'100px', render: (type)=>( {type} @@ -451,10 +451,10 @@ const{isLoading:isDeletingItem} = deleteData function copyLink(selectedRecord:any){ navigator.clipboard.writeText('') const eventId = selectedRecord.id - const marketplaceLink = `https://marketplace.dev.flexable.com/events/${eventId}` + const marketplaceLink = `https://marketplace.dev.flexabledats.com/events/${eventId}` + // const marketplaceLink = `http://localhost:3002/events/${eventId}` // Copy the text inside the text field navigator.clipboard.writeText(marketplaceLink); - console.log(selectedRecord) } From e1af936f92d98b37e738cb6226af8a93b5ddc0f9 Mon Sep 17 00:00:00 2001 From: mbappai Date: Mon, 25 Sep 2023 08:25:44 +0100 Subject: [PATCH 2/5] refactor: use new org APIs --- .../OrganizationsPage/OrganizationList/OrganizationView.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/OrganizationsPage/OrganizationList/OrganizationView.tsx b/components/OrganizationsPage/OrganizationList/OrganizationView.tsx index 1bde5d95..b29c6c32 100644 --- a/components/OrganizationsPage/OrganizationList/OrganizationView.tsx +++ b/components/OrganizationsPage/OrganizationList/OrganizationView.tsx @@ -61,7 +61,7 @@ export default function AdminOrgsView(){ async function fetchAllOrgs(){ const res = await axios({ method:'get', - url:`${process.env.NEXT_PUBLIC_NEW_API_URL}/${urlPrefix}/orgs?pageNumber=${pageNumber}&pageSize=10&key2=created_by`, + url:`${process.env.NEXT_PUBLIC_NEW_API_URL}/${urlPrefix}/orgs?pageNumber=${pageNumber}&pageSize=10&status=1`, headers:{ "Authorization": paseto } @@ -74,7 +74,7 @@ export default function AdminOrgsView(){ async function fetchOrgs(){ const res = await axios({ method:'get', - url:`${process.env.NEXT_PUBLIC_NEW_API_URL}/${urlPrefix}/orgs?key=status&value=${currentStatus.id}&pageNumber=${pageNumber}&pageSize=${pageSize}&key2=created_by`, + url:`${process.env.NEXT_PUBLIC_NEW_API_URL}/${urlPrefix}/orgs?pageNumber=${pageNumber}&pageSize=${pageSize}&status=${currentStatus.id}`, headers:{ "Authorization": paseto } From 776ad45d5fa05bb479ca262dbc44c4a0a2b52d6c Mon Sep 17 00:00:00 2001 From: mbappai Date: Mon, 25 Sep 2023 12:25:05 +0100 Subject: [PATCH 3/5] refactor: change orgs APIs --- .../OrganizationsPage/OrganizationList/OrganizationView.tsx | 4 ---- pages/organizations/venues/exclusive-access/index.tsx | 4 ++-- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/components/OrganizationsPage/OrganizationList/OrganizationView.tsx b/components/OrganizationsPage/OrganizationList/OrganizationView.tsx index b29c6c32..a39e81ae 100644 --- a/components/OrganizationsPage/OrganizationList/OrganizationView.tsx +++ b/components/OrganizationsPage/OrganizationList/OrganizationView.tsx @@ -84,8 +84,6 @@ export default function AdminOrgsView(){ } - - async function changeOrgStatus({orgId, statusNumber}:{orgId:string, statusNumber: string}){ const res = await axios({ method:'patch', @@ -102,9 +100,7 @@ export default function AdminOrgsView(){ return res; } - - const changeStatusMutation = useMutation(['orgs'],{ mutationFn: changeOrgStatus, onSuccess:(data:any)=>{ diff --git a/pages/organizations/venues/exclusive-access/index.tsx b/pages/organizations/venues/exclusive-access/index.tsx index 31600972..6e137b20 100644 --- a/pages/organizations/venues/exclusive-access/index.tsx +++ b/pages/organizations/venues/exclusive-access/index.tsx @@ -33,8 +33,8 @@ export default function Services(){ // ServiceItems // minHeight:'70vh', }} > - - + + From ebb58df2ebf1cce473e7f1a5691fdf3ccdb49d10 Mon Sep 17 00:00:00 2001 From: mbappai Date: Mon, 25 Sep 2023 14:07:38 +0100 Subject: [PATCH 4/5] refactor: handle error pages --- pages/404.js | 12 ++++++++++++ pages/404.tsx | 11 ----------- pages/500.tsx | 13 +++++++++++-- tsconfig.json | 2 +- 4 files changed, 24 insertions(+), 14 deletions(-) create mode 100644 pages/404.js delete mode 100644 pages/404.tsx diff --git a/pages/404.js b/pages/404.js new file mode 100644 index 00000000..1b9af926 --- /dev/null +++ b/pages/404.js @@ -0,0 +1,12 @@ +import {Typography,Button} from 'antd' +import { useRouter } from 'next/router' + +export default function Custom404() { + const router = useRouter() + return ( +
+ 404 - Page Not Found + +
+ ) + } \ No newline at end of file diff --git a/pages/404.tsx b/pages/404.tsx deleted file mode 100644 index 64fecc71..00000000 --- a/pages/404.tsx +++ /dev/null @@ -1,11 +0,0 @@ -import {Typography,Button} from 'antd' -import { useRouter } from 'next/router' - -export default function Custom404() { - const router = useRouter() - return (
- 404 - Page Not Found - -
- ) - } \ No newline at end of file diff --git a/pages/500.tsx b/pages/500.tsx index d5f1962d..afe2afe6 100644 --- a/pages/500.tsx +++ b/pages/500.tsx @@ -1,5 +1,14 @@ -import {Typography} from 'antd' +import {Button, Typography} from 'antd' +import { useRouter } from 'next/router' export default function Custom500() { - return 500 - Server side error occured + const router = useRouter() + return( +
+ + 500 - Server side error occured + + +
+ ) } \ No newline at end of file diff --git a/tsconfig.json b/tsconfig.json index dd872241..a50166c2 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -15,6 +15,6 @@ "jsx": "preserve", "incremental": true }, - "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", "components/shared/ErrorBoundary/ServiceItemErrorBoundary.js"], + "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", "components/shared/ErrorBoundary/ServiceItemErrorBoundary.js", "pages/404.js"], "exclude": ["node_modules"] } From 39db293765f99a228855978f477c4cf1a83990a1 Mon Sep 17 00:00:00 2001 From: mbappai Date: Mon, 25 Sep 2023 14:29:07 +0100 Subject: [PATCH 5/5] refactor: only display address and contactNumber when not empty --- .../ManagerOrgsView/ManagerOrgsView.tsx | 26 ++++++++---- .../OrganizationList/OrganizationView.tsx | 40 ++++++++++++------- 2 files changed, 45 insertions(+), 21 deletions(-) diff --git a/components/Manager/Organizations/ManagerOrgsView/ManagerOrgsView.tsx b/components/Manager/Organizations/ManagerOrgsView/ManagerOrgsView.tsx index b0d9dfba..743a9a6e 100644 --- a/components/Manager/Organizations/ManagerOrgsView/ManagerOrgsView.tsx +++ b/components/Manager/Organizations/ManagerOrgsView/ManagerOrgsView.tsx @@ -2,7 +2,7 @@ import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query"; import { NewOrg } from "../../../../types/OrganisationTypes"; import useOrgs from "../../../../hooks/useOrgs"; const {Text,Title} = Typography -import { SearchOutlined, PlusOutlined, LikeOutlined, DislikeOutlined } from '@ant-design/icons'; +import { SearchOutlined, PlusOutlined, LikeOutlined, DashOutlined, DislikeOutlined } from '@ant-design/icons'; import type { FilterConfirmProps } from 'antd/es/table/interface'; import React, { useRef, useState } from 'react' import {Typography,Button,Avatar, Alert, Upload, Tag, Image, Descriptions, Table, InputRef, Input, Space, DatePicker, Radio, Dropdown, MenuProps, Drawer, Row, Col, Divider, Form, Modal, notification} from 'antd' @@ -477,12 +477,20 @@ export default function ManagerOrgsView(){ key: 'address', width:'370px', ellipsis: true, - render:(_,record)=>( -
- {record.country} - {record.street} -
+ render:(_,record)=>{ + return( + <> + { + record.street !== '' + ?
+ {record.country} + {record.street} +
+ : + } + ) + } }, { @@ -491,8 +499,12 @@ export default function ManagerOrgsView(){ key: 'contactNumber', width:'150px', render: (_,record)=>( + <> + { //@ts-ignore - {convertToAmericanFormat(record.contactNumber)} + record.contactNumber !=='' ?{convertToAmericanFormat(record.contactNumber)}: + } + ) }, { diff --git a/components/OrganizationsPage/OrganizationList/OrganizationView.tsx b/components/OrganizationsPage/OrganizationList/OrganizationView.tsx index a39e81ae..503cbbe2 100644 --- a/components/OrganizationsPage/OrganizationList/OrganizationView.tsx +++ b/components/OrganizationsPage/OrganizationList/OrganizationView.tsx @@ -10,7 +10,7 @@ import {Typography,Button,Avatar, Upload, Tag, Image, Descriptions, Table, Input import { useRouter } from 'next/router' import Highlighter from 'react-highlight-words' import axios from 'axios'; -import {MoreOutlined,ReloadOutlined} from '@ant-design/icons' +import {MoreOutlined,ReloadOutlined,DashOutlined} from '@ant-design/icons' import { FilterDropdownProps, FilterValue, SorterResult } from 'antd/lib/table/interface'; import { useAuthContext } from '../../../context/AuthContext'; @@ -100,7 +100,7 @@ export default function AdminOrgsView(){ return res; } - + const changeStatusMutation = useMutation(['orgs'],{ mutationFn: changeOrgStatus, onSuccess:(data:any)=>{ @@ -365,27 +365,39 @@ export default function AdminOrgsView(){ }, { title: 'Address', - // dataIndex: 'address', + dataIndex: 'address', key: 'address', width:'370px', - ellipsis:true, - render:(_,record)=>( -
- {record.country} - {record.street} -
+ ellipsis: true, + render:(_,record)=>{ + return( + <> + { + record.street !== '' + ?
+ {record.country} + {record.street} +
+ : + } + ) + } }, - { + { title: 'Contact Number', dataIndex: 'contactNumber', key: 'contactNumber', width:'150px', - render:(number)=>{ - const formattedNumber = convertToAmericanFormat(number) - return {formattedNumber} - } + render: (_,record)=>( + <> + { + //@ts-ignore + record.contactNumber !=='' ?{convertToAmericanFormat(record.contactNumber)}: + } + + ) }, { title: 'Created On',