Skip to content

Commit

Permalink
UPDATE: to only show buttons on dev
Browse files Browse the repository at this point in the history
  • Loading branch information
JeremiahUy committed Nov 1, 2024
1 parent a2890d4 commit a40a46c
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ import {
IGetParsedOptionsProps,
} from '../../../services/Codelist'
import { user } from '../../../services/User'
import { isDev } from '../../../util/config'
import { ScrollToFieldError } from '../../../util/formikUtils'
import { BoolField, FieldWrapper, OptionList, TextAreaField } from '../../common/Inputs'
import LabelWithTooltip, { LabelWithDescription } from '../../common/LabelWithTooltip'
Expand Down Expand Up @@ -75,9 +76,6 @@ export const EtterlevelseDokumentasjonForm = (props: TEditEtterlevelseDokumentas
const [customPersonForDev, setCustomPersonForDev] = useState<string>('')
const [customRisikoeierForDev, setCustomRisikoeierForDev] = useState<string>('')

const isDev: boolean =
window.location.origin.includes('.dev.') || window.location.origin.includes('localhost')

const isForRedigering: boolean = window.location.pathname.includes('/edit')

const labelNavngiDokument: string = isForRedigering
Expand Down
42 changes: 23 additions & 19 deletions apps/frontend/src/pages/DokumentasjonPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import { getEtterlevelseDokumentasjonStatsQuery } from '../query/EtterlevelseDok
import { ampli, userRoleEventProp } from '../services/Amplitude'
import { CodelistService, EListName, TTemaCode } from '../services/Codelist'
import { user } from '../services/User'
import { isDev } from '../util/config'
import { dokumentasjonerBreadCrumbPath } from './util/BreadCrumbPath'

export const DokumentasjonPage = () => {
Expand Down Expand Up @@ -230,23 +231,26 @@ export const DokumentasjonPage = () => {
/>
)}

<Button
onClick={() => {
navigate(
'/dokumentasjon/' +
etterlevelseDokumentasjon.id +
'/behandlingens-livslop/'
)
}}
size="small"
variant="primary"
className="whitespace-nowrap"
>
{/* {behandligensLivslop ? 'Rediger behandlinges livsløp' : 'Tegn behandlingens livsløp'} */}
Tegn behandlingens livsløp
</Button>

{(!pvkDokument || !pvkDokument.skalUtforePvk) && (
{/*WIP ikke klar til å vises i prod*/}
{isDev && (
<Button
onClick={() => {
navigate(
'/dokumentasjon/' +
etterlevelseDokumentasjon.id +
'/behandlingens-livslop/'
)
}}
size="small"
variant="primary"
className="whitespace-nowrap"
>
{/* {behandligensLivslop ? 'Rediger behandlinges livsløp' : 'Tegn behandlingens livsløp'} */}
Tegn behandlingens livsløp
</Button>
)}
{/*WIP ikke klar til å vises i prod*/}
{(!pvkDokument || !pvkDokument.skalUtforePvk) && isDev && (
<Button
onClick={() => {
let pvkBehovUrl =
Expand All @@ -266,8 +270,8 @@ export const DokumentasjonPage = () => {
{pvkDokument ? 'Revurdér behov for PVK' : 'Vurdér behov for PVK'}
</Button>
)}

{pvkDokument && pvkDokument.skalUtforePvk && (
{/*WIP ikke klar til å vises i prod*/}
{pvkDokument && pvkDokument.skalUtforePvk && isDev && (
<Button
onClick={() => {
navigate(
Expand Down
3 changes: 3 additions & 0 deletions apps/frontend/src/util/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,6 @@ export const teamKatTeamLink = (id: string) => `${env.teamKatBaseUrl}team/${id}`
export const behandlingLink = (id: string) => `${env.pollyBaseUrl}process/${id}`
export const termUrl = (termId: string) =>
`https://navno.sharepoint.com/sites/begreper/SitePages/Begrep.aspx?bid=${termId}`

export const isDev: boolean =
window.location.origin.includes('.dev.') || window.location.origin.includes('localhost')

0 comments on commit a40a46c

Please sign in to comment.