Skip to content

Commit

Permalink
feat(app): ECB-56: temporarily set alertData to empty array so the al…
Browse files Browse the repository at this point in the history
…ert page section is not displayed - fix build automation errors (#1446)

<!--- Please provide a general summary of your changes in the title
above -->

# Pull Request type

<!-- Please try to limit your pull request to one type; submit multiple
pull requests if needed. -->

Please check the type of change your PR introduces:

- [ ] Bugfix
- [x] Feature
- [ ] Code style update (formatting, renaming)
- [ ] Refactoring (no functional changes, no API changes)
- [ ] Build-related changes
- [ ] Documentation content changes
- [ ] Other (please describe):

## What is the current behavior?

<!-- Please describe the current behavior that you are modifying, or
link to a relevant issue. -->

Issue Number: N/A

## What is the new behavior?

this PR addresses some build automation errors from the previous PR of a
similar name



-
-
-

## Does this introduce a breaking change?

- [ ] Yes
- [x] No

<!-- If this does introduce a breaking change, please describe the
impact and migration path for existing applications below. -->

## Other information

<!-- Any other information that is important to this PR, such as
screenshots of how the component looks before and after the change. -->
  • Loading branch information
trigal2012 authored Jan 15, 2025
2 parents e00bc69 + a2f4cd7 commit caf78a5
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 64 deletions.
24 changes: 4 additions & 20 deletions apps/app/src/pages/org/[slug]/[orgLocationId]/edit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import { prefixedId } from '@weareinreach/api/schemas/idPrefix'
import { trpcServerClient } from '@weareinreach/api/trpc'
import { checkServerPermissions } from '@weareinreach/auth'
import { Button } from '@weareinreach/ui/components/core'
import { AlertMessage } from '@weareinreach/ui/components/core/AlertMessage'
import { Toolbar } from '@weareinreach/ui/components/core/Toolbar'
import { MultiSelectPopover } from '@weareinreach/ui/components/data-portal/MultiSelectPopover/hook-form'
import { ServiceEditDrawer } from '@weareinreach/ui/components/data-portal/ServiceEditDrawer'
Expand Down Expand Up @@ -59,14 +58,10 @@ const OrgLocationPage: NextPage<InferGetServerSidePropsType<typeof getServerSide
const { data, status } = api.location.forLocationPageEdits.useQuery({ id: orgLocationId })
const { mutate: revalidatePage } = api.misc.revalidatePage.useMutation()

interface Alert {
key: string
icon: string
text: string
}

const { data: alertData }: { data: Alert[] } = { data: [] }

const { data: alertData } = api.location.getAlerts.useQuery(
{ id: orgLocationId },
{ enabled: router.isReady }
)
// for use with MultiSelectPopover

const { data: orgServices } = api.service.getNames.useQuery(
Expand All @@ -85,7 +80,6 @@ const OrgLocationPage: NextPage<InferGetServerSidePropsType<typeof getServerSide
values: defaultFormValues,
})

const hasAlerts = Array.isArray(alertData) && alertData.length > 0
const { classes } = useStyles()

const servicesRef = useRef<HTMLDivElement>(null)
Expand Down Expand Up @@ -181,16 +175,6 @@ const OrgLocationPage: NextPage<InferGetServerSidePropsType<typeof getServerSide
organizationId={data.organization.id}
/>
<Stack pt={24} align='flex-start' spacing={40}>
{hasAlerts &&
alertData.map((alert) => (
<AlertMessage
key={alert.key}
iconKey={alert.icon}
ns={data.organization.id}
textKey={alert.key}
defaultText={alert.text}
/>
))}
<ListingBasicInfo
data={{
slug,
Expand Down
20 changes: 1 addition & 19 deletions apps/app/src/pages/org/[slug]/[orgLocationId]/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,10 @@ import Head from 'next/head'
import { useRouter } from 'next/router'
import { useTranslation } from 'next-i18next'
import { type RoutedQuery } from 'nextjs-routes'
import { useCallback, useEffect, useMemo, useRef, useState } from 'react'
import { useCallback, useEffect, useRef, useState } from 'react'
import { z } from 'zod'

import { trpcServerClient } from '@weareinreach/api/trpc'
import { AlertMessage } from '@weareinreach/ui/components/core/AlertMessage'
import { Toolbar } from '@weareinreach/ui/components/core/Toolbar'
import { ContactSection } from '@weareinreach/ui/components/sections/ContactSection'
import { ListingBasicInfo } from '@weareinreach/ui/components/sections/ListingBasicInfo'
Expand Down Expand Up @@ -53,13 +52,6 @@ const OrgLocationPage: NextPage = () => {
error: pageFetchError,
} = api.location.forLocationPage.useQuery({ id: orgLocationId }, { enabled: router.isReady })

interface Alert {
key: string
icon: string
text: string
}

const { data: alertData }: { data: Alert[] } = { data: [] }
const { classes } = useStyles()

const servicesRef = useRef<HTMLDivElement>(null)
Expand Down Expand Up @@ -123,16 +115,6 @@ const OrgLocationPage: NextPage = () => {
organizationId={orgData.id}
/>
<Stack pt={24} align='flex-start' spacing={40}>
{hasAlerts &&
alertData?.map((alert) => (
<AlertMessage
key={alert.key}
iconKey={alert.icon}
ns={orgData.id}
textKey={alert.key}
defaultText={alert.text}
/>
))}
<ListingBasicInfo
data={{
name: data.name ?? orgData.name,
Expand Down
25 changes: 0 additions & 25 deletions apps/app/src/pages/org/[slug]/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import { type RoutedQuery } from 'nextjs-routes'
import { useCallback, useEffect, useRef, useState } from 'react'

import { trpcServerClient } from '@weareinreach/api/trpc'
import { AlertMessage } from '@weareinreach/ui/components/core/AlertMessage'
import { Toolbar } from '@weareinreach/ui/components/core/Toolbar'
import { ContactSection } from '@weareinreach/ui/components/sections/ContactSection'
import { ListingBasicInfo } from '@weareinreach/ui/components/sections/ListingBasicInfo'
Expand Down Expand Up @@ -62,15 +61,6 @@ const OrganizationPage = ({
}
)

interface Alert {
key: string
icon: string
text: string
}

const { data: alertData }: { data: Alert[] } = { data: [] }

const hasAlerts = Array.isArray(alertData) && alertData.length > 0
const { ref, width } = useElementSize()
const { searchState } = useSearchState()
const theme = useMantineTheme()
Expand Down Expand Up @@ -205,21 +195,6 @@ const OrganizationPage = ({
organizationId={organizationId}
/>
<Stack pt={24} align='flex-start' spacing={40}>
{hasAlerts &&
alertData.map((alert) => {
if (!alert.key) {
return null
}
return (
<AlertMessage
key={alert.key}
iconKey={alert.icon}
ns={organizationId}
textKey={alert.key}
defaultText={alert.text}
/>
)
})}
<ListingBasicInfo
data={{
name: data.name,
Expand Down

0 comments on commit caf78a5

Please sign in to comment.