Skip to content

Commit

Permalink
Merge pull request #53 from socialappslab/fix/no-ticket/router
Browse files Browse the repository at this point in the history
fix: Fix router to redirect to HomePage
  • Loading branch information
zant authored Nov 4, 2024
2 parents c081bf2 + dff045e commit c7eff25
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 22 deletions.
10 changes: 7 additions & 3 deletions src/components/RiskChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,13 @@ const RiskChart = () => {
{loading && <Loader />}
{!loading && (
<>
<ProgressBar label={t('riskChart.greenSites')} progress={data?.greenQuantity || 0} color="green-600" />
<ProgressBar label={t('riskChart.yellowSites')} progress={data?.orangeQuantity || 0} color="yellow-600" />
<ProgressBar label={t('riskChart.redSites')} progress={data?.redQuantity || 0} color="red-600" />
<ProgressBar label={t('riskChart.greenSites')} progress={data?.greenQuantity || 0} color="bg-green-600" />
<ProgressBar
label={t('riskChart.yellowSites')}
progress={data?.orangeQuantity || 0}
color="bg-yellow-600"
/>
<ProgressBar label={t('riskChart.redSites')} progress={data?.redQuantity || 0} color="bg-red-600" />
</>
)}
</Box>
Expand Down
4 changes: 2 additions & 2 deletions src/components/SitesReport.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ const SitesReport = () => {
<Title label={t('sitesReport.title')} type="subsection" className="mb-0" />
<Box className="flex flex-col mt-6">
<>
<ProgressBar label={t('sitesReport.title')} progress={60} color="green-600" />
<ProgressBar label={t('sitesReport.quantity')} progress={80} color="green-800" />
<ProgressBar label={t('sitesReport.title')} progress={60} color="bg-green-600" />
<ProgressBar label={t('sitesReport.quantity')} progress={80} color="bg-green-800" />
</>
</Box>
</Box>
Expand Down
15 changes: 15 additions & 0 deletions src/pages/my-community/MyCommunityPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,20 @@ import Title from '@/themed/title/Title';

type Sort = 'asc' | 'desc';

const LookerStudioEmbed = () => {
return (
<iframe
title="Looker Stuio"
width="100%"
height="450"
src="https://lookerstudio.google.com/embed/reporting/3e09d10b-e76e-4540-9627-4068431ff44b/page/e1SEE"
className="border-0"
allowFullScreen
sandbox="allow-storage-access-by-user-activation allow-scripts allow-same-origin allow-popups allow-popups-to-escape-sandbox"
/>
);
};

const MyCommunity = () => {
const { t } = useTranslation(['feed', 'errorCodes']);
const [error, setError] = useState('');
Expand Down Expand Up @@ -103,6 +117,7 @@ const MyCommunity = () => {
<Box className="flex pt-6 gap-6">
<Box className="bg-gray-300 h-full w-full">
<SitesReport />
<LookerStudioEmbed />
<InfiniteScroll
loader={<Loader />}
hasMore={hasMore}
Expand Down
32 changes: 20 additions & 12 deletions src/routes/AppRouter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,24 +41,32 @@ const queryClient = new QueryClient({
const router = createBrowserRouter([
{
path: '/',
element: (
<PageLayout>
<AppHome />
</PageLayout>
),
errorElement: <RouterErrorPage />,
},
{
path: 'my-city',
element: (
<ProtectedRoute>
<PageLayout>
<AppHome />
<Outlet />
<MyCity />,
</PageLayout>
</ProtectedRoute>
),
},
{
path: 'my-community',
element: (
<ProtectedRoute>
<PageLayout>
<MyCommunity />,
</PageLayout>
</ProtectedRoute>
),
children: [
{
path: 'my-city',
element: <MyCity />,
},
{
path: 'my-community',
element: <MyCommunity />,
},
],
errorElement: <RouterErrorPage />,
},
{
Expand Down
7 changes: 2 additions & 5 deletions src/themed/progress-bar/ProgressBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,8 @@ export const ProgressBar: React.FC<ProgressBarProps> = ({ label, progress, color
</Box>
<Box className="flex-row items-center">
<Box className="relative w-11/12 rounded-full h-2" style={{ width: '100%' }}>
<Box
className={`absolute top-0 left-0 h-full rounded-full bg-${color} opacity-30`}
style={{ width: `100%` }}
/>
<Box className={`absolute top-0 left-0 h-full rounded-full bg-${color}`} style={{ width: `${progress}%` }} />
<Box className={`absolute top-0 left-0 h-full rounded-full ${color} opacity-30`} style={{ width: `100%` }} />
<Box className={`absolute top-0 left-0 h-full rounded-full ${color}`} style={{ width: `${progress}%` }} />
</Box>
</Box>
</Box>
Expand Down

0 comments on commit c7eff25

Please sign in to comment.