From e2a9bd97da7a3241f64eb1e7695e0518f2d0d192 Mon Sep 17 00:00:00 2001 From: nradkova Date: Fri, 15 Jul 2022 07:41:25 +0300 Subject: [PATCH 01/14] removed: campaign type translation --- src/components/campaigns/CampaignInfo.tsx | 2 +- src/components/campaigns/CampaignTypeSelect.tsx | 4 +--- src/components/campaigns/grid/CampaignGrid.tsx | 4 +--- src/components/campaigns/grid/modals/DetailsModal.tsx | 4 +--- 4 files changed, 4 insertions(+), 10 deletions(-) diff --git a/src/components/campaigns/CampaignInfo.tsx b/src/components/campaigns/CampaignInfo.tsx index 2153ce489..b2bb2a9f1 100644 --- a/src/components/campaigns/CampaignInfo.tsx +++ b/src/components/campaigns/CampaignInfo.tsx @@ -116,7 +116,7 @@ export default function CampaignInfo({ campaign }: Props) { {t('campaigns:filters.' + `${campaign.campaignType.category}`)}/{' '} - {t('campaigns:campaign.types.' + `${campaign.campaignType?.slug}`)} + {campaign.campaignType.name} {/* TODO: Dynamic campaign tagging is needed here based on activity (urgent, hot, the long-shot, etc) diff --git a/src/components/campaigns/CampaignTypeSelect.tsx b/src/components/campaigns/CampaignTypeSelect.tsx index 7956773b3..93ca73d4a 100644 --- a/src/components/campaigns/CampaignTypeSelect.tsx +++ b/src/components/campaigns/CampaignTypeSelect.tsx @@ -9,8 +9,6 @@ export default function CampaignTypeSelect({ name = 'campaignTypeId' }) { const { data } = useCampaignTypesList() const [field, meta] = useField(name) - console.log(data) - const helperText = meta.touched ? translateError(meta.error as TranslatableField, t) : '' return ( {data?.map((campaignType, index) => ( - {t('campaigns:campaign.types.' + `${campaignType.slug}`)} + {campaignType.name} ))} diff --git a/src/components/campaigns/grid/CampaignGrid.tsx b/src/components/campaigns/grid/CampaignGrid.tsx index 0461e2550..2fbf3a8b4 100644 --- a/src/components/campaigns/grid/CampaignGrid.tsx +++ b/src/components/campaigns/grid/CampaignGrid.tsx @@ -158,9 +158,7 @@ export default function CampaignGrid() { ...commonProps, align: 'left', width: 250, - renderCell: (cellValues: GridRenderCellParams) => ( - <>{t('campaigns:campaign.types.' + `${cellValues.row.campaignType.slug}`)} - ), + renderCell: (cellValues: GridRenderCellParams) => <>{cellValues.row.campaignType.name}, }, { field: 'description', diff --git a/src/components/campaigns/grid/modals/DetailsModal.tsx b/src/components/campaigns/grid/modals/DetailsModal.tsx index 7d5633632..f4c88d19f 100644 --- a/src/components/campaigns/grid/modals/DetailsModal.tsx +++ b/src/components/campaigns/grid/modals/DetailsModal.tsx @@ -41,9 +41,7 @@ export default function DetailsModal({ campaign, onClose }: Props) { Крайна Дата: {getExactDateTime(campaign.endDate)} Същество: {campaign.essence} - - Тип на кампанията: {t('campaigns:campaign.types.' + `${campaign.campaignType.slug}`)} - + Тип на кампанията: {campaign.campaignType.name} Бенефициент: {campaign.beneficiary.person.firstName}{' '} {campaign.beneficiary.person.lastName} From 9f77478b1cd52eb5469125da066cde97c07e5c91 Mon Sep 17 00:00:00 2001 From: nradkova Date: Thu, 14 Jul 2022 16:19:10 +0300 Subject: [PATCH 02/14] fixed: component name --- src/components/layout/nav/AdminMenu.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/layout/nav/AdminMenu.tsx b/src/components/layout/nav/AdminMenu.tsx index ab13c83fa..57e4f3503 100644 --- a/src/components/layout/nav/AdminMenu.tsx +++ b/src/components/layout/nav/AdminMenu.tsx @@ -56,7 +56,7 @@ const allNavItems: NavItem[] = [ export const navItems = allNavItems.filter((el) => typeof el.enabled === 'undefined' ?? el.enabled) -export default function DevelopmentMenu() { +export default function AdminMenu() { const { t } = useTranslation() const router = useRouter() From b22f23332f659a0aca3f73821f9d6a810f365337 Mon Sep 17 00:00:00 2001 From: nradkova Date: Thu, 14 Jul 2022 16:21:03 +0300 Subject: [PATCH 03/14] added: admin links to PrivateMenu --- src/components/layout/nav/PrivateMenu.tsx | 45 ++++++++++++++++++++--- 1 file changed, 39 insertions(+), 6 deletions(-) diff --git a/src/components/layout/nav/PrivateMenu.tsx b/src/components/layout/nav/PrivateMenu.tsx index 42d49e711..612ca0f39 100644 --- a/src/components/layout/nav/PrivateMenu.tsx +++ b/src/components/layout/nav/PrivateMenu.tsx @@ -9,6 +9,7 @@ import theme from 'common/theme' import { routes } from 'common/routes' import { isAdmin } from 'common/util/roles' import LinkMenuItem from 'components/common/LinkMenuItem' +import { useRouter } from 'next/router' const PREFIX = 'PrivateMenu' @@ -33,9 +34,32 @@ const StyledGrid = styled(Grid)(({ theme }) => ({ }, })) +type NavItem = { + href: string + label: string + target?: string + enabled?: boolean +} + +const adminItems: NavItem[] = [ + { + href: routes.admin.index, + label: 'nav.admin.index', + }, + { + href: routes.admin.infoRequests, + label: 'nav.admin.info-requests', + }, + { + href: routes.admin.supporters, + label: 'nav.admin.supporters', + }, +] + export default function PrivateMenu() { const { t } = useTranslation() const { data: session, status } = useSession() + const router = useRouter() const [anchorEl, setAnchorEl] = useState(null) const handleMenu = (event: React.MouseEvent) => setAnchorEl(event.currentTarget) @@ -52,7 +76,7 @@ export default function PrivateMenu() { {session?.user?.picture ? ( ) : ( - + )} {t('nav.profile')} - {status === 'authenticated' && isAdmin(session) && ( - - {t('nav.admin.index')} - - )} + {status === 'authenticated' && + isAdmin(session) && + adminItems.map(({ href, label, target }, key) => ( + + + {t(label)} + + + ))} {t('nav.logout')} From 373f2c910321dbee0e7159b48dc245480b2d8ff6 Mon Sep 17 00:00:00 2001 From: nradkova Date: Thu, 14 Jul 2022 16:22:55 +0300 Subject: [PATCH 04/14] removed: AdminMenu from MainNavMenu --- src/components/layout/nav/MainNavMenu.tsx | 9 --------- 1 file changed, 9 deletions(-) diff --git a/src/components/layout/nav/MainNavMenu.tsx b/src/components/layout/nav/MainNavMenu.tsx index ac96d4ae0..7408a1d08 100644 --- a/src/components/layout/nav/MainNavMenu.tsx +++ b/src/components/layout/nav/MainNavMenu.tsx @@ -1,19 +1,15 @@ import React from 'react' -import { useSession } from 'next-auth/react' import { Button, Grid } from '@mui/material' import { useTranslation } from 'next-i18next' import { staticUrls } from 'common/routes' -import { isAdmin } from 'common/util/roles' import DonationMenu from './DonationMenu' import ProjectMenu from './ProjectMenu' -import AdminMenu from './AdminMenu' import DevelopmentMenu from './DevelopmentMenu' export default function MainNavMenu({ children }: { children?: React.ReactNode }) { const { t } = useTranslation() - const { data: session, status } = useSession() return ( @@ -26,11 +22,6 @@ export default function MainNavMenu({ children }: { children?: React.ReactNode } - {status === 'authenticated' && isAdmin(session) && ( - - - - )} From 0da9a383752b01a4872e18168a49b56543b21ac3 Mon Sep 17 00:00:00 2001 From: Ivan Milchev Date: Fri, 15 Jul 2022 10:27:53 +0200 Subject: [PATCH 13/14] updated kustomization Signed-off-by: Ivan Milchev --- manifests/overlays/production/kustomization.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/manifests/overlays/production/kustomization.yaml b/manifests/overlays/production/kustomization.yaml index 4c9dc0774..1d0b35610 100644 --- a/manifests/overlays/production/kustomization.yaml +++ b/manifests/overlays/production/kustomization.yaml @@ -7,12 +7,12 @@ resources: - ../../base patches: - - path: secrets-web.local.yaml +# - path: secrets-web.local.yaml - path: keycloak-config-web.patch.yaml - path: deployment.patch.yaml images: - name: ghcr.io/podkrepi-bg/frontend - newTag: v0.9.8 + newTag: v0.9.9 - name: ghcr.io/podkrepi-bg/frontend/maintenance newTag: master From 28ee664febc3155f5c89911236918af6ebe7a193 Mon Sep 17 00:00:00 2001 From: Borislav Stoychev Date: Fri, 15 Jul 2022 13:20:03 +0300 Subject: [PATCH 14/14] Tab orientation vertical when mobile device (#890) * tab orientation vertical when mobile device * fixed: tab text alignment --- src/components/one-time-donation/steps/SecondStep.tsx | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/components/one-time-donation/steps/SecondStep.tsx b/src/components/one-time-donation/steps/SecondStep.tsx index 59abe6e70..0a17839f4 100644 --- a/src/components/one-time-donation/steps/SecondStep.tsx +++ b/src/components/one-time-donation/steps/SecondStep.tsx @@ -1,6 +1,6 @@ import { TabContext, TabList } from '@mui/lab' import TabPanel from '@mui/lab/TabPanel' -import { Box, Tab, Typography } from '@mui/material' +import { Box, Tab, Typography, useMediaQuery } from '@mui/material' import { useTranslation } from 'next-i18next' import React, { useState } from 'react' import AnonymousMenu from '../AnonymousForm' @@ -9,6 +9,7 @@ import RegisterForm from '../RegisterDialog' export default function SecondStep() { const { t } = useTranslation('one-time-donation') + const mobile = useMediaQuery('(max-width:575px)') const [value, setValue] = useState('1') @@ -21,7 +22,13 @@ export default function SecondStep() { {t('step-labels.personal-profile')} {t('second-step.intro-text')} - +