parent
b665f065b7
commit
a2f462e261
|
@ -7,7 +7,6 @@ import {networkRetry} from '#/lib/async/retry'
|
||||||
import {logger} from '#/logger'
|
import {logger} from '#/logger'
|
||||||
import * as persisted from '#/state/persisted'
|
import * as persisted from '#/state/persisted'
|
||||||
import {PUBLIC_BSKY_AGENT} from '#/state/queries'
|
import {PUBLIC_BSKY_AGENT} from '#/state/queries'
|
||||||
import {IS_PROD} from '#/lib/constants'
|
|
||||||
import {emitSessionDropped} from '../events'
|
import {emitSessionDropped} from '../events'
|
||||||
import {useLoggedOutViewControls} from '#/state/shell/logged-out'
|
import {useLoggedOutViewControls} from '#/state/shell/logged-out'
|
||||||
import {useCloseAllActiveElements} from '#/state/util'
|
import {useCloseAllActiveElements} from '#/state/util'
|
||||||
|
@ -36,7 +35,6 @@ export type SessionState = {
|
||||||
}
|
}
|
||||||
export type StateContext = SessionState & {
|
export type StateContext = SessionState & {
|
||||||
hasSession: boolean
|
hasSession: boolean
|
||||||
isSandbox: boolean
|
|
||||||
}
|
}
|
||||||
export type ApiContext = {
|
export type ApiContext = {
|
||||||
createAccount: (props: {
|
createAccount: (props: {
|
||||||
|
@ -84,7 +82,6 @@ const StateContext = React.createContext<StateContext>({
|
||||||
accounts: [],
|
accounts: [],
|
||||||
currentAccount: undefined,
|
currentAccount: undefined,
|
||||||
hasSession: false,
|
hasSession: false,
|
||||||
isSandbox: false,
|
|
||||||
})
|
})
|
||||||
|
|
||||||
const ApiContext = React.createContext<ApiContext>({
|
const ApiContext = React.createContext<ApiContext>({
|
||||||
|
@ -610,9 +607,6 @@ export function Provider({children}: React.PropsWithChildren<{}>) {
|
||||||
() => ({
|
() => ({
|
||||||
...state,
|
...state,
|
||||||
hasSession: !!state.currentAccount,
|
hasSession: !!state.currentAccount,
|
||||||
isSandbox: state.currentAccount
|
|
||||||
? !IS_PROD(state.currentAccount?.service)
|
|
||||||
: false,
|
|
||||||
}),
|
}),
|
||||||
[state],
|
[state],
|
||||||
)
|
)
|
||||||
|
|
|
@ -46,7 +46,7 @@ export function FeedPage({
|
||||||
renderEmptyState: () => JSX.Element
|
renderEmptyState: () => JSX.Element
|
||||||
renderEndOfFeed?: () => JSX.Element
|
renderEndOfFeed?: () => JSX.Element
|
||||||
}) {
|
}) {
|
||||||
const {isSandbox, hasSession} = useSession()
|
const {hasSession} = useSession()
|
||||||
const pal = usePalette('default')
|
const pal = usePalette('default')
|
||||||
const {_} = useLingui()
|
const {_} = useLingui()
|
||||||
const navigation = useNavigation()
|
const navigation = useNavigation()
|
||||||
|
@ -119,7 +119,7 @@ export function FeedPage({
|
||||||
style={[pal.text, {fontWeight: 'bold'}]}
|
style={[pal.text, {fontWeight: 'bold'}]}
|
||||||
text={
|
text={
|
||||||
<>
|
<>
|
||||||
{isSandbox ? 'SANDBOX' : 'Bluesky'}{' '}
|
Bluesky{' '}
|
||||||
{hasNew && (
|
{hasNew && (
|
||||||
<View
|
<View
|
||||||
style={{
|
style={{
|
||||||
|
@ -154,16 +154,7 @@ export function FeedPage({
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
return <></>
|
return <></>
|
||||||
}, [
|
}, [isDesktop, pal.view, pal.text, pal.textLight, hasNew, _, hasSession])
|
||||||
isDesktop,
|
|
||||||
pal.view,
|
|
||||||
pal.text,
|
|
||||||
pal.textLight,
|
|
||||||
hasNew,
|
|
||||||
_,
|
|
||||||
isSandbox,
|
|
||||||
hasSession,
|
|
||||||
])
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<View testID={testID} style={s.h100pct}>
|
<View testID={testID} style={s.h100pct}>
|
||||||
|
|
|
@ -37,7 +37,6 @@ export function FeedsTabBar(
|
||||||
|
|
||||||
function FeedsTabBarPublic() {
|
function FeedsTabBarPublic() {
|
||||||
const pal = usePalette('default')
|
const pal = usePalette('default')
|
||||||
const {isSandbox} = useSession()
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<CenteredView sideBorders>
|
<CenteredView sideBorders>
|
||||||
|
@ -56,23 +55,7 @@ function FeedsTabBarPublic() {
|
||||||
type="title-lg"
|
type="title-lg"
|
||||||
href="/"
|
href="/"
|
||||||
style={[pal.text, {fontWeight: 'bold'}]}
|
style={[pal.text, {fontWeight: 'bold'}]}
|
||||||
text={
|
text="Bluesky "
|
||||||
<>
|
|
||||||
{isSandbox ? 'SANDBOX' : 'Bluesky'}{' '}
|
|
||||||
{/*hasNew && (
|
|
||||||
<View
|
|
||||||
style={{
|
|
||||||
top: -8,
|
|
||||||
backgroundColor: colors.blue3,
|
|
||||||
width: 8,
|
|
||||||
height: 8,
|
|
||||||
borderRadius: 4,
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
)*/}
|
|
||||||
</>
|
|
||||||
}
|
|
||||||
// onPress={emitSoftReset}
|
|
||||||
/>
|
/>
|
||||||
</View>
|
</View>
|
||||||
</CenteredView>
|
</CenteredView>
|
||||||
|
|
|
@ -27,7 +27,6 @@ import {PostCtrls} from '../util/post-ctrls/PostCtrls'
|
||||||
import {PostHider} from '../util/moderation/PostHider'
|
import {PostHider} from '../util/moderation/PostHider'
|
||||||
import {ContentHider} from '../util/moderation/ContentHider'
|
import {ContentHider} from '../util/moderation/ContentHider'
|
||||||
import {PostAlerts} from '../util/moderation/PostAlerts'
|
import {PostAlerts} from '../util/moderation/PostAlerts'
|
||||||
import {PostSandboxWarning} from '../util/PostSandboxWarning'
|
|
||||||
import {ErrorMessage} from '../util/error/ErrorMessage'
|
import {ErrorMessage} from '../util/error/ErrorMessage'
|
||||||
import {usePalette} from 'lib/hooks/usePalette'
|
import {usePalette} from 'lib/hooks/usePalette'
|
||||||
import {formatCount} from '../util/numeric/format'
|
import {formatCount} from '../util/numeric/format'
|
||||||
|
@ -247,7 +246,6 @@ let PostThreadItemLoaded = ({
|
||||||
testID={`postThreadItem-by-${post.author.handle}`}
|
testID={`postThreadItem-by-${post.author.handle}`}
|
||||||
style={[styles.outer, styles.outerHighlighted, pal.border, pal.view]}
|
style={[styles.outer, styles.outerHighlighted, pal.border, pal.view]}
|
||||||
accessible={false}>
|
accessible={false}>
|
||||||
<PostSandboxWarning />
|
|
||||||
<View style={[styles.layout]}>
|
<View style={[styles.layout]}>
|
||||||
<View style={[styles.layoutAvi, {paddingBottom: 8}]}>
|
<View style={[styles.layoutAvi, {paddingBottom: 8}]}>
|
||||||
<PreviewableUserAvatar
|
<PreviewableUserAvatar
|
||||||
|
@ -438,8 +436,6 @@ let PostThreadItemLoaded = ({
|
||||||
? {marginRight: 4}
|
? {marginRight: 4}
|
||||||
: {marginLeft: 2, marginRight: 2}
|
: {marginLeft: 2, marginRight: 2}
|
||||||
}>
|
}>
|
||||||
<PostSandboxWarning />
|
|
||||||
|
|
||||||
<View
|
<View
|
||||||
style={{
|
style={{
|
||||||
flexDirection: 'row',
|
flexDirection: 'row',
|
||||||
|
|
|
@ -21,7 +21,6 @@ import {PostEmbeds} from '../util/post-embeds'
|
||||||
import {ContentHider} from '../util/moderation/ContentHider'
|
import {ContentHider} from '../util/moderation/ContentHider'
|
||||||
import {PostAlerts} from '../util/moderation/PostAlerts'
|
import {PostAlerts} from '../util/moderation/PostAlerts'
|
||||||
import {RichText} from '../util/text/RichText'
|
import {RichText} from '../util/text/RichText'
|
||||||
import {PostSandboxWarning} from '../util/PostSandboxWarning'
|
|
||||||
import {PreviewableUserAvatar} from '../util/UserAvatar'
|
import {PreviewableUserAvatar} from '../util/UserAvatar'
|
||||||
import {s} from 'lib/styles'
|
import {s} from 'lib/styles'
|
||||||
import {usePalette} from 'lib/hooks/usePalette'
|
import {usePalette} from 'lib/hooks/usePalette'
|
||||||
|
@ -160,8 +159,6 @@ let FeedItemInner = ({
|
||||||
href={href}
|
href={href}
|
||||||
noFeedback
|
noFeedback
|
||||||
accessible={false}>
|
accessible={false}>
|
||||||
<PostSandboxWarning />
|
|
||||||
|
|
||||||
<View style={{flexDirection: 'row', gap: 10, paddingLeft: 8}}>
|
<View style={{flexDirection: 'row', gap: 10, paddingLeft: 8}}>
|
||||||
<View style={{width: 52}}>
|
<View style={{width: 52}}>
|
||||||
{isThreadChild && (
|
{isThreadChild && (
|
||||||
|
|
|
@ -1,35 +0,0 @@
|
||||||
import React from 'react'
|
|
||||||
import {StyleSheet, View} from 'react-native'
|
|
||||||
import {Text} from './text/Text'
|
|
||||||
import {usePalette} from 'lib/hooks/usePalette'
|
|
||||||
import {useSession} from '#/state/session'
|
|
||||||
|
|
||||||
export function PostSandboxWarning() {
|
|
||||||
const {isSandbox} = useSession()
|
|
||||||
const pal = usePalette('default')
|
|
||||||
if (isSandbox) {
|
|
||||||
return (
|
|
||||||
<View style={styles.container}>
|
|
||||||
<Text
|
|
||||||
type="title-2xl"
|
|
||||||
style={[pal.text, styles.text]}
|
|
||||||
accessible={false}>
|
|
||||||
SANDBOX
|
|
||||||
</Text>
|
|
||||||
</View>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
return null
|
|
||||||
}
|
|
||||||
|
|
||||||
const styles = StyleSheet.create({
|
|
||||||
container: {
|
|
||||||
position: 'absolute',
|
|
||||||
top: 6,
|
|
||||||
right: 10,
|
|
||||||
},
|
|
||||||
text: {
|
|
||||||
fontWeight: 'bold',
|
|
||||||
opacity: 0.07,
|
|
||||||
},
|
|
||||||
})
|
|
|
@ -9,14 +9,13 @@ import {FEEDBACK_FORM_URL, HELP_DESK_URL} from 'lib/constants'
|
||||||
import {s} from 'lib/styles'
|
import {s} from 'lib/styles'
|
||||||
import {useWebMediaQueries} from 'lib/hooks/useWebMediaQueries'
|
import {useWebMediaQueries} from 'lib/hooks/useWebMediaQueries'
|
||||||
import {useLingui} from '@lingui/react'
|
import {useLingui} from '@lingui/react'
|
||||||
import {Trans, msg} from '@lingui/macro'
|
import {msg} from '@lingui/macro'
|
||||||
import {useSession} from '#/state/session'
|
import {useSession} from '#/state/session'
|
||||||
|
|
||||||
export function DesktopRightNav({routeName}: {routeName: string}) {
|
export function DesktopRightNav({routeName}: {routeName: string}) {
|
||||||
const pal = usePalette('default')
|
const pal = usePalette('default')
|
||||||
const palError = usePalette('error')
|
|
||||||
const {_} = useLingui()
|
const {_} = useLingui()
|
||||||
const {isSandbox, hasSession, currentAccount} = useSession()
|
const {hasSession, currentAccount} = useSession()
|
||||||
|
|
||||||
const {isTablet} = useWebMediaQueries()
|
const {isTablet} = useWebMediaQueries()
|
||||||
if (isTablet) {
|
if (isTablet) {
|
||||||
|
@ -49,13 +48,6 @@ export function DesktopRightNav({routeName}: {routeName: string}) {
|
||||||
paddingTop: hasSession ? 0 : 18,
|
paddingTop: hasSession ? 0 : 18,
|
||||||
},
|
},
|
||||||
]}>
|
]}>
|
||||||
{isSandbox ? (
|
|
||||||
<View style={[palError.view, styles.messageLine, s.p10]}>
|
|
||||||
<Text type="md" style={[palError.text, s.bold]}>
|
|
||||||
<Trans>SANDBOX. Posts and accounts are not permanent.</Trans>
|
|
||||||
</Text>
|
|
||||||
</View>
|
|
||||||
) : undefined}
|
|
||||||
<View style={[{flexWrap: 'wrap'}, s.flexRow]}>
|
<View style={[{flexWrap: 'wrap'}, s.flexRow]}>
|
||||||
{hasSession && (
|
{hasSession && (
|
||||||
<>
|
<>
|
||||||
|
|
Loading…
Reference in New Issue