Skip to content

Commit

Permalink
Use admonitions in settings screens (#5741)
Browse files Browse the repository at this point in the history
  • Loading branch information
mozzius authored Oct 14, 2024
1 parent 240535f commit ef5bc52
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 38 deletions.
13 changes: 8 additions & 5 deletions src/components/Admonition.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react'
import {View} from 'react-native'
import {StyleProp, View, ViewStyle} from 'react-native'

import {atoms as a, useBreakpoints, useTheme} from '#/alf'
import {CircleInfo_Stroke2_Corner0_Rounded as ErrorIcon} from '#/components/icons/CircleInfo'
Expand Down Expand Up @@ -70,9 +70,11 @@ export function Row({children}: {children: React.ReactNode}) {
export function Outer({
children,
type = 'info',
style,
}: {
children: React.ReactNode
type?: Context['type']
style?: StyleProp<ViewStyle>
}) {
const t = useTheme()
const {gtMobile} = useBreakpoints()
Expand All @@ -90,9 +92,8 @@ export function Outer({
a.rounded_sm,
a.border,
t.atoms.bg_contrast_25,
{
borderColor,
},
{borderColor},
style,
]}>
{children}
</View>
Expand All @@ -103,12 +104,14 @@ export function Outer({
export function Admonition({
children,
type,
style,
}: {
children: TextProps['children']
type?: Context['type']
style?: StyleProp<ViewStyle>
}) {
return (
<Outer type={type}>
<Outer type={type} style={style}>
<Row>
<Icon />
<Text>{children}</Text>
Expand Down
25 changes: 8 additions & 17 deletions src/screens/Messages/Settings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ import {useSession} from '#/state/session'
import * as Toast from '#/view/com/util/Toast'
import {ViewHeader} from '#/view/com/util/ViewHeader'
import {ScrollView} from '#/view/com/util/Views'
import {atoms as a, useTheme} from '#/alf'
import {atoms as a} from '#/alf'
import {Admonition} from '#/components/Admonition'
import {Divider} from '#/components/Divider'
import * as Toggle from '#/components/forms/Toggle'
import {Text} from '#/components/Typography'
Expand All @@ -23,7 +24,6 @@ type AllowIncoming = 'all' | 'none' | 'following'
type Props = NativeStackScreenProps<CommonNavigatorParams, 'MessagesSettings'>
export function MessagesSettingsScreen({}: Props) {
const {_} = useLingui()
const t = useTheme()
const {currentAccount} = useSession()
const {data: profile} = useProfileQuery({
did: currentAccount!.did,
Expand Down Expand Up @@ -99,21 +99,12 @@ export function MessagesSettingsScreen({}: Props) {
</Toggle.Item>
</View>
</Toggle.Group>
<View
style={[
a.mt_sm,
a.px_xl,
a.py_lg,
a.rounded_md,
t.atoms.bg_contrast_25,
]}>
<Text style={[t.atoms.text_contrast_high, a.leading_snug]}>
<Trans>
You can continue ongoing conversations regardless of which setting
you choose.
</Trans>
</Text>
</View>
<Admonition type="tip">
<Trans>
You can continue ongoing conversations regardless of which setting
you choose.
</Trans>
</Admonition>
{isNative && (
<>
<Divider style={a.my_md} />
Expand Down
24 changes: 8 additions & 16 deletions src/view/screens/NotificationsSettings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {useNotificationsSettingsMutation} from '#/state/queries/notifications/se
import {ViewHeader} from '#/view/com/util/ViewHeader'
import {ScrollView} from '#/view/com/util/Views'
import {atoms as a, useTheme} from '#/alf'
import {Admonition} from '#/components/Admonition'
import {Error} from '#/components/Error'
import * as Toggle from '#/components/forms/Toggle'
import {Loader} from '#/components/Loader'
Expand Down Expand Up @@ -71,22 +72,13 @@ export function NotificationsSettingsScreen({}: Props) {
</Toggle.Item>
</View>
</Toggle.Group>
<View
style={[
a.mt_sm,
a.px_xl,
a.py_lg,
a.rounded_md,
t.atoms.bg_contrast_25,
]}>
<Text style={[t.atoms.text_contrast_high, a.leading_snug]}>
<Trans>
Experimental: When this preference is enabled, you'll only
receive reply and quote notifications from users you follow.
We'll continue to add more controls here over time.
</Trans>
</Text>
</View>
<Admonition type="warning" style={[a.mt_sm]}>
<Trans>
Experimental: When this preference is enabled, you'll only receive
reply and quote notifications from users you follow. We'll
continue to add more controls here over time.
</Trans>
</Admonition>
</View>
)}
</ScrollView>
Expand Down

0 comments on commit ef5bc52

Please sign in to comment.