mirror of https://git.lenooby09.tech/LeNooby09/social-app.git
1import React from 'react'
2import {StyleSheet, View} from 'react-native'
3import {usePalette} from 'lib/hooks/usePalette'
4import {DesktopSearch} from './Search'
5import {DesktopFeeds} from './Feeds'
6import {Text} from 'view/com/util/text/Text'
7import {TextLink} from 'view/com/util/Link'
8import {FEEDBACK_FORM_URL, HELP_DESK_URL} from 'lib/constants'
9import {s} from 'lib/styles'
10import {useWebMediaQueries} from 'lib/hooks/useWebMediaQueries'
11import {useLingui} from '@lingui/react'
12import {msg} from '@lingui/macro'
13import {useSession} from '#/state/session'
14
15export function DesktopRightNav({routeName}: {routeName: string}) {
16 const pal = usePalette('default')
17 const {_} = useLingui()
18 const {hasSession, currentAccount} = useSession()
19
20 const {isTablet} = useWebMediaQueries()
21 if (isTablet) {
22 return null
23 }
24
25 return (
26 <View style={[styles.rightNav, pal.view]}>
27 <View style={{paddingVertical: 20}}>
28 {routeName === 'Search' ? (
29 <View style={{marginBottom: 18}}>
30 <DesktopFeeds />
31 </View>
32 ) : (
33 <>
34 <DesktopSearch />
35
36 {hasSession && (
37 <View style={[pal.border, styles.desktopFeedsContainer]}>
38 <DesktopFeeds />
39 </View>
40 )}
41 </>
42 )}
43
44 <View
45 style={[
46 styles.message,
47 {
48 paddingTop: hasSession ? 0 : 18,
49 },
50 ]}>
51 <View style={[{flexWrap: 'wrap'}, s.flexRow]}>
52 {hasSession && (
53 <>
54 <TextLink
55 type="md"
56 style={pal.link}
57 href={FEEDBACK_FORM_URL({
58 email: currentAccount?.email,
59 handle: currentAccount?.handle,
60 })}
61 text={_(msg`Feedback`)}
62 />
63 <Text type="md" style={pal.textLight}>
64 ·
65 </Text>
66 </>
67 )}
68 <TextLink
69 type="md"
70 style={pal.link}
71 href="https://bsky.social/about/support/privacy-policy"
72 text={_(msg`Privacy`)}
73 />
74 <Text type="md" style={pal.textLight}>
75 ·
76 </Text>
77 <TextLink
78 type="md"
79 style={pal.link}
80 href="https://bsky.social/about/support/tos"
81 text={_(msg`Terms`)}
82 />
83 <Text type="md" style={pal.textLight}>
84 ·
85 </Text>
86 <TextLink
87 type="md"
88 style={pal.link}
89 href={HELP_DESK_URL}
90 text={_(msg`Help`)}
91 />
92 </View>
93 </View>
94 </View>
95 </View>
96 )
97}
98
99const styles = StyleSheet.create({
100 rightNav: {
101 // @ts-ignore web only
102 position: 'fixed',
103 // @ts-ignore web only
104 left: 'calc(50vw + 300px + 20px)',
105 width: 300,
106 maxHeight: '100%',
107 overflowY: 'auto',
108 },
109
110 message: {
111 paddingVertical: 18,
112 paddingHorizontal: 12,
113 },
114 messageLine: {
115 marginBottom: 10,
116 },
117 desktopFeedsContainer: {
118 borderTopWidth: 1,
119 borderBottomWidth: 1,
120 marginTop: 18,
121 marginBottom: 18,
122 },
123})