Skip to content

Commit

Permalink
fix issue on fetch data and styles
Browse files Browse the repository at this point in the history
  • Loading branch information
zuies committed Jan 19, 2024
1 parent e3f8e16 commit 7e26509
Show file tree
Hide file tree
Showing 7 changed files with 40 additions and 24 deletions.
2 changes: 1 addition & 1 deletion src/components/announcements/TcAnnouncementsTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ function TcAnnouncementsTable({
colSpan={6}
style={{ textAlign: 'center' }}
sx={{ borderBottom: 'none' }}
className="min-h-[70vh] pt-[14rem]"
className="min-h-[70vh] pt-[20dvh]"
data-testid="loading-indicator"
>
<Loading />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,17 @@ function TcConfirmSchaduledAnnouncementsDialog({
<>
<TcButton
text={buttonLabel}
sx={{
maxWidth: {
xs: '100%',
sm: '8rem',
},
padding: {
xs: 'auto',
sm: '0.4rem 1.5rem',
},
height: '2.4rem',
}}
variant="contained"
disabled={isDisabled}
onClick={() => setConfirmSchadulerDialog(true)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,11 +129,11 @@ function TcPrivateMessageContainer({

if (!templateText) {
templateText = item.template;
setPrivateMessage(true);
}
}
});

setPrivateMessage(true);
setSelectedRoles(rolesArray);
setSelectedUsers(usersArray);
setMessage(templateText);
Expand Down Expand Up @@ -213,7 +213,7 @@ function TcPrivateMessageContainer({
className="text-gray-400"
/>
</div>
<div className="flex justify-between space-x-3">
<div className="flex flex-col md:flex-row justify-between space-y-3 md:space-y-0 md:space-x-3">
<FormControl
variant="filled"
fullWidth
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ function TcPublicMessagePreviewDialog({
xs: '100%',
sm: '8rem',
},
padding: {
xs: 'auto',
sm: '0.4rem 1.5rem',
},
height: '2.4rem',
}}
disabled={!isPreviewDialogEnabled}
Expand Down
2 changes: 0 additions & 2 deletions src/components/shared/TcBreadcrumbs.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import React from 'react';
import Breadcrumbs from '@mui/material/Breadcrumbs';
import Link from '@mui/material/Link';
import { useRouter } from 'next/router';
import TcLink from './TcLink';
import { ArrowDropDownIcon } from '@mui/x-date-pickers';
import { MdChevronRight } from 'react-icons/md';
import TcText from './TcText';

Expand Down
6 changes: 5 additions & 1 deletion src/pages/announcements/edit-announcements/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ function Index() {
(channel) => channel.channelId
);
}
console.log({ channelIds });

await refreshData(platformId, 'channel', channelIds, undefined, false);
}
Expand All @@ -130,9 +131,12 @@ function Index() {
};

fetchAnnouncement();
fetchPlatformChannels();
}, [id]);

useEffect(() => {
fetchPlatformChannels();
}, [fetchedAnnouncements]);

const handleEditAnnouncements = async (isDrafted: boolean) => {
if (!community) return;

Expand Down
35 changes: 17 additions & 18 deletions src/pages/announcements/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,8 @@ function Index() {
<div className="flex flex-col container px-4 md:px-12 py-4">
<TcBoxContainer
contentContainerChildren={
<div className="flex flex-col justify-between p-4 md:p-10 space-y-4 min-h-[92dvh]">
<div>
<div className="flex flex-col justify-between p-4 md:p-10 space-y-4 min-h-[97dvh] max-h-[97dvh]">
<div className="flex-grow overflow-auto min-h-[calc(100vh-100px)]">
<div className="flex flex-col md:flex-row md:justify-between space-y-3 md:space-y-0 md:items-center">
<TcText text="Announcement Scheduling" variant="h5" />
<TcButton
Expand Down Expand Up @@ -217,22 +217,21 @@ function Index() {
</div>
)}
</div>

{fetchedAnnouncements.totalResults > 8 ? (
<div className="flex justify-end">
<TcPagination
totalItems={fetchedAnnouncements.totalResults}
itemsPerPage={Math.ceil(
fetchedAnnouncements.totalResults /
fetchedAnnouncements.totalPages
)}
currentPage={page}
onChangePage={handlePageChange}
/>
</div>
) : (
''
)}
<div className="sticky bottom-0 bg-white px-4 py-2 min-h-[70px]">
{fetchedAnnouncements.totalResults > 8 && (
<div className="flex justify-end">
<TcPagination
totalItems={fetchedAnnouncements.totalResults}
itemsPerPage={Math.ceil(
fetchedAnnouncements.totalResults /
fetchedAnnouncements.totalPages
)}
currentPage={page}
onChangePage={handlePageChange}
/>
</div>
)}
</div>
</div>
}
/>
Expand Down

0 comments on commit 7e26509

Please sign in to comment.