Skip to content

Commit

Permalink
Merged PR 31966: Remove attention and implementations
Browse files Browse the repository at this point in the history
Met Herjen besproken dat deze eruit kan
  • Loading branch information
frankfe-amsterdam committed Aug 29, 2024
2 parents 9225f65 + 3dafed1 commit 7eaf85d
Show file tree
Hide file tree
Showing 11 changed files with 51 additions and 164 deletions.
18 changes: 0 additions & 18 deletions src/components/ui/feedback/Attention.stories.tsx

This file was deleted.

36 changes: 0 additions & 36 deletions src/components/ui/feedback/Attention.tsx

This file was deleted.

13 changes: 0 additions & 13 deletions src/components/ui/feedback/Warning.stories.tsx

This file was deleted.

18 changes: 0 additions & 18 deletions src/components/ui/feedback/Warning.tsx

This file was deleted.

4 changes: 1 addition & 3 deletions src/components/ui/feedback/alert/AlertBase.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,7 @@ export const AlertBase = ({
ref={setAccessibilityFocus}
style={styles?.view}
testID={testID}>
{children ? (
children
) : (
{children ?? (
<Row align="between">
<SingleSelectable
accessibilityLabel={accessibleText(title, text)}
Expand Down
12 changes: 0 additions & 12 deletions src/components/ui/feedback/alert/AlertInformation.tsx

This file was deleted.

41 changes: 36 additions & 5 deletions src/modules/home/components/ModuleSettings.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,22 @@
import {pascalCase} from 'pascal-case'
import {getVersion} from 'react-native-device-info'
import {NoInternetErrorFullScreen} from '@/components/features/NoInternetFullScreenError'
import {Box} from '@/components/ui/containers/Box'
import {EmptyMessage} from '@/components/ui/feedback/EmptyMessage'
import {PleaseWait} from '@/components/ui/feedback/PleaseWait'
import {Column} from '@/components/ui/layout/Column'
import {FullScreenError} from '@/components/ui/layout/FullScreenError'
import {ModulesFigure} from '@/components/ui/media/errors/ModulesFigure'
import {Paragraph} from '@/components/ui/text/Paragraph'
import {useSelector} from '@/hooks/redux/useSelector'
import {useModules} from '@/hooks/useModules'
import {ModuleSetting} from '@/modules/home/components/ModuleSetting'
import {ModulesWarning} from '@/modules/home/components/ModulesWarning'
import {selectIsInternetReachable} from '@/store/slices/internetConnection'

export const ModuleSettings = () => {
const {toggleableModules, modulesLoading} = useModules()
const {modulesError, toggleableModules, modulesLoading, refetchModules} =
useModules()
const isInternetReachable = useSelector(selectIsInternetReachable)

if (modulesLoading) {
return (
Expand All @@ -20,14 +27,38 @@ export const ModuleSettings = () => {
)
}

if (!toggleableModules || toggleableModules.length === 0) {
if (modulesError || !toggleableModules) {
if (isInternetReachable === false) {
return <NoInternetErrorFullScreen />
}

return (
<ModulesWarning
text={`We hebben geen modules gevonden voor versie ${getVersion()} van de app.`}
<FullScreenError
buttonAccessibilityLabel="Laad de modules opnieuw"
buttonLabel="Laad opnieuw"
error={modulesError}
Image={ModulesFigure}
onPress={refetchModules}
testProps={{
testID: 'ModuleSettingsErrorScreen',
}}
text="Probeer het later opnieuw."
title="Helaas kunnen de modules niet geladen worden"
/>
)
}

if (!toggleableModules.length) {
return (
<Box>
<EmptyMessage
testID="ModuleSettingsEmptyList"
text={`We hebben geen modules gevonden voor versie ${getVersion()} van de app.`}
/>
</Box>
)
}

return (
<Box>
<Column gutter="md">
Expand Down
34 changes: 7 additions & 27 deletions src/modules/home/components/Modules.tsx
Original file line number Diff line number Diff line change
@@ -1,38 +1,18 @@
import {pascalCase} from 'pascal-case'
import {Box} from '@/components/ui/containers/Box'
import {EmptyMessage} from '@/components/ui/feedback/EmptyMessage'
import {PleaseWait} from '@/components/ui/feedback/PleaseWait'
import {Column} from '@/components/ui/layout/Column'
import {useModules} from '@/hooks/useModules'
import {ModuleButton} from '@/modules/home/components/ModuleButton'
import {ModulesWarning} from '@/modules/home/components/ModulesWarning'
import {ModuleStatus} from '@/modules/types'
import {ModuleStatus, type Module} from '@/modules/types'

export const Modules = () => {
const {enabledModules, modulesError, modulesLoading, refetchModules} =
useModules()

if (modulesLoading) {
return (
<PleaseWait
grow
testID="HomeModulesLoadingSpinner"
/>
)
}

if (modulesError || !enabledModules) {
return (
<ModulesWarning
onRetry={refetchModules}
text="Er is iets misgegaan bij het ophalen van de modules."
/>
)
}
type Props = {
modules: Module[]
}

const availableModules = enabledModules?.filter(m => !m.hiddenInMenu)
export const Modules = ({modules}: Props) => {
const availableModules = modules?.filter(m => !m.hiddenInMenu)

if (!availableModules.length) {
if (!modules.length) {
return (
<Box>
<EmptyMessage
Expand Down
26 changes: 0 additions & 26 deletions src/modules/home/components/ModulesWarning.tsx

This file was deleted.

7 changes: 4 additions & 3 deletions src/modules/home/screens/Home.screen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ import {Modules} from '@/modules/home/components/Modules'
import {selectIsInternetReachable} from '@/store/slices/internetConnection'

export const HomeScreen = () => {
const {modulesError, modulesLoading, refetchModules} = useModules()
const {enabledModules, modulesError, modulesLoading, refetchModules} =
useModules()
const {isPortrait} = useDeviceContext()

const isInternetReachable = useSelector(selectIsInternetReachable)
Expand All @@ -19,7 +20,7 @@ export const HomeScreen = () => {
return <PleaseWait testID="HomeLoadingSpinner" />
}

if (modulesError) {
if (modulesError || !enabledModules) {
if (isInternetReachable === false) {
return <NoInternetErrorFullScreen />
}
Expand Down Expand Up @@ -48,7 +49,7 @@ export const HomeScreen = () => {

return (
<Screen testID="HomeScreen">
<Modules />
<Modules modules={enabledModules} />
</Screen>
)
}
6 changes: 3 additions & 3 deletions src/modules/waste-guide/components/Fraction.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {Attention} from '@/components/ui/feedback/Attention'
import {AlertBase} from '@/components/ui/feedback/alert/AlertBase'
import {AlertWarning} from '@/components/ui/feedback/alert/AlertWarning'
import {Column} from '@/components/ui/layout/Column'
import {Row} from '@/components/ui/layout/Row'
Expand Down Expand Up @@ -140,12 +140,12 @@ export const Fraction = ({fraction, testID}: Props) => {
/>
</Column>
{!!afvalwijzerAfvalkalenderOpmerking && (
<Attention>
<AlertBase testID={testID + 'Remark'}>
<FractionContent
content={afvalwijzerAfvalkalenderOpmerking}
testID={`${testID}RemarksContent`}
/>
</Attention>
</AlertBase>
)}
</Column>
)
Expand Down

0 comments on commit 7eaf85d

Please sign in to comment.