Skip to content

Commit

Permalink
Merge branch 'bluesky-social:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
auroursa authored Dec 13, 2024
2 parents 953be02 + add7a91 commit 26bff1a
Show file tree
Hide file tree
Showing 51 changed files with 1,650 additions and 1,014 deletions.
1 change: 1 addition & 0 deletions assets/icons/pin_filled_stroke2_corner0_rounded.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
"icons:optimize": "svgo -f ./assets/icons"
},
"dependencies": {
"@atproto/api": "^0.13.18",
"@atproto/api": "^0.13.20",
"@bitdrift/react-native": "0.4.0",
"@braintree/sanitize-url": "^6.0.2",
"@discord/bottom-sheet": "bluesky-social/react-native-bottom-sheet",
Expand Down Expand Up @@ -206,7 +206,7 @@
"zod": "^3.20.2"
},
"devDependencies": {
"@atproto/dev-env": "^0.3.64",
"@atproto/dev-env": "^0.3.67",
"@babel/core": "^7.26.0",
"@babel/preset-env": "^7.26.0",
"@babel/runtime": "^7.26.0",
Expand Down
5 changes: 4 additions & 1 deletion src/App.native.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ import {
import {readLastActiveAccount} from '#/state/session/util'
import {Provider as ShellStateProvider} from '#/state/shell'
import {Provider as ComposerProvider} from '#/state/shell/composer'
import {Provider as LightStatusBarProvider} from '#/state/shell/light-status-bar'
import {Provider as LoggedOutViewProvider} from '#/state/shell/logged-out'
import {Provider as ProgressGuideProvider} from '#/state/shell/progress-guide'
import {Provider as SelectedFeedProvider} from '#/state/shell/selected-feed'
Expand Down Expand Up @@ -209,7 +210,9 @@ function App() {
<SafeAreaProvider
initialMetrics={initialWindowMetrics}>
<IntentDialogProvider>
<InnerApp />
<LightStatusBarProvider>
<InnerApp />
</LightStatusBarProvider>
</IntentDialogProvider>
</SafeAreaProvider>
</StarterPackProvider>
Expand Down
5 changes: 4 additions & 1 deletion src/App.web.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ import {
import {readLastActiveAccount} from '#/state/session/util'
import {Provider as ShellStateProvider} from '#/state/shell'
import {Provider as ComposerProvider} from '#/state/shell/composer'
import {Provider as LightStatusBarProvider} from '#/state/shell/light-status-bar'
import {Provider as LoggedOutViewProvider} from '#/state/shell/logged-out'
import {Provider as ProgressGuideProvider} from '#/state/shell/progress-guide'
import {Provider as SelectedFeedProvider} from '#/state/shell/selected-feed'
Expand Down Expand Up @@ -181,7 +182,9 @@ function App() {
<PortalProvider>
<StarterPackProvider>
<IntentDialogProvider>
<InnerApp />
<LightStatusBarProvider>
<InnerApp />
</LightStatusBarProvider>
</IntentDialogProvider>
</StarterPackProvider>
</PortalProvider>
Expand Down
2 changes: 1 addition & 1 deletion src/Navigation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ import {NotificationsScreen} from '#/view/screens/Notifications'
import {PostThreadScreen} from '#/view/screens/PostThread'
import {PrivacyPolicyScreen} from '#/view/screens/PrivacyPolicy'
import {ProfileScreen} from '#/view/screens/Profile'
import {ProfileFeedScreen} from '#/view/screens/ProfileFeed'
import {ProfileFeedLikedByScreen} from '#/view/screens/ProfileFeedLikedBy'
import {ProfileListScreen} from '#/view/screens/ProfileList'
import {SavedFeeds} from '#/view/screens/SavedFeeds'
Expand All @@ -75,6 +74,7 @@ import {PostLikedByScreen} from '#/screens/Post/PostLikedBy'
import {PostQuotesScreen} from '#/screens/Post/PostQuotes'
import {PostRepostedByScreen} from '#/screens/Post/PostRepostedBy'
import {ProfileKnownFollowersScreen} from '#/screens/Profile/KnownFollowers'
import {ProfileFeedScreen} from '#/screens/Profile/ProfileFeed'
import {ProfileFollowersScreen} from '#/screens/Profile/ProfileFollowers'
import {ProfileFollowsScreen} from '#/screens/Profile/ProfileFollows'
import {ProfileLabelerLikedByScreen} from '#/screens/Profile/ProfileLabelerLikedBy'
Expand Down
4 changes: 4 additions & 0 deletions src/alf/themes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ export function createThemes({
dim: Theme
} {
const color = {
like: '#ec4899',
trueBlack: '#000000',

gray_0: `hsl(${hues.primary}, 20%, ${defaultScale[14]}%)`,
Expand Down Expand Up @@ -124,6 +125,7 @@ export function createThemes({
const lightPalette = {

Check warning on line 125 in src/alf/themes.ts

View workflow job for this annotation

GitHub Actions / Run linters

'lightPalette' is already declared in the upper scope on line 22 column 14
white: color.gray_0,
black: color.gray_1000,
like: color.like,

contrast_25: color.gray_25,
contrast_50: color.gray_50,
Expand Down Expand Up @@ -185,6 +187,7 @@ export function createThemes({
const darkPalette: Palette = {

Check warning on line 187 in src/alf/themes.ts

View workflow job for this annotation

GitHub Actions / Run linters

'darkPalette' is already declared in the upper scope on line 26 column 14
white: color.gray_25,
black: color.trueBlack,
like: color.like,

contrast_25: color.gray_975,
contrast_50: color.gray_950,
Expand Down Expand Up @@ -246,6 +249,7 @@ export function createThemes({
const dimPalette: Palette = {

Check warning on line 249 in src/alf/themes.ts

View workflow job for this annotation

GitHub Actions / Run linters

'dimPalette' is already declared in the upper scope on line 30 column 14
...darkPalette,
black: `hsl(${hues.primary}, 28%, ${dimScale[0]}%)`,
like: color.like,

contrast_25: `hsl(${hues.primary}, 28%, ${dimScale[1]}%)`,
contrast_50: `hsl(${hues.primary}, 28%, ${dimScale[2]}%)`,
Expand Down
1 change: 1 addition & 0 deletions src/alf/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export type ThemeName = 'light' | 'dim' | 'dark'
export type Palette = {
white: string
black: string
like: string

contrast_25: string
contrast_50: string
Expand Down
22 changes: 3 additions & 19 deletions src/components/FeedInterstitials.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import {msg, Trans} from '@lingui/macro'
import {useLingui} from '@lingui/react'
import {useNavigation} from '@react-navigation/native'

import {useWebMediaQueries} from '#/lib/hooks/useWebMediaQueries'
import {NavigationProp} from '#/lib/routes/types'
import {logEvent} from '#/lib/statsig/statsig'
import {logger} from '#/logger'
Expand All @@ -16,7 +15,6 @@ import {FeedDescriptor} from '#/state/queries/post-feed'
import {useProfilesQuery} from '#/state/queries/profile'
import {useSuggestedFollowsByActorQuery} from '#/state/queries/suggested-follows'
import {useSession} from '#/state/session'
import {useProgressGuide} from '#/state/shell/progress-guide'
import * as userActionHistory from '#/state/userActionHistory'
import {SeenPost} from '#/state/userActionHistory'
import {atoms as a, useBreakpoints, useTheme, ViewStyleProp, web} from '#/alf'
Expand Down Expand Up @@ -506,23 +504,9 @@ export function SuggestedFeeds() {

export function ProgressGuide() {
const t = useTheme()
const {isDesktop} = useWebMediaQueries()
const guide = useProgressGuide('like-10-and-follow-7')

if (isDesktop) {
return null
}

return guide ? (
<View
style={[
a.border_t,
t.atoms.border_contrast_low,
a.px_lg,
a.py_lg,
a.pb_lg,
]}>
return (
<View style={[t.atoms.border_contrast_low, a.px_lg, a.py_lg, a.pb_lg]}>
<ProgressGuideList />
</View>
) : null
)
}
3 changes: 2 additions & 1 deletion src/components/Layout/Header/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,8 @@ export function TitleText({
gtMobile && a.text_xl,
style,
]}
numberOfLines={2}>
numberOfLines={2}
emoji>
{children}
</Text>
)
Expand Down
4 changes: 3 additions & 1 deletion src/components/Layout/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,21 +21,23 @@ export * as Header from '#/components/Layout/Header'

export type ScreenProps = React.ComponentProps<typeof View> & {
style?: StyleProp<ViewStyle>
noInsetTop?: boolean
}

/**
* Outermost component of every screen
*/
export const Screen = React.memo(function Screen({
style,
noInsetTop,
...props
}: ScreenProps) {
const {top} = useSafeAreaInsets()
return (
<>
{isWeb && <WebCenterBorders />}
<View
style={[a.util_screen_outer, {paddingTop: top}, style]}
style={[a.util_screen_outer, {paddingTop: noInsetTop ? 0 : top}, style]}
{...props}
/>
</>
Expand Down
20 changes: 20 additions & 0 deletions src/components/Menu/context.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,23 @@ export const Context = React.createContext<ContextType>({
export const ItemContext = React.createContext<ItemContextType>({
disabled: false,
})

export function useMenuContext() {
const context = React.useContext(Context)

if (!context) {
throw new Error('useMenuContext must be used within a Context.Provider')
}

return context
}

export function useMenuItemContext() {
const context = React.useContext(ItemContext)

if (!context) {
throw new Error('useMenuItemContext must be used within a Context.Provider')
}

return context
}
36 changes: 18 additions & 18 deletions src/components/Menu/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,12 @@ import {atoms as a, useTheme} from '#/alf'
import {Button, ButtonText} from '#/components/Button'
import * as Dialog from '#/components/Dialog'
import {useInteractionState} from '#/components/hooks/useInteractionState'
import {Context, ItemContext} from '#/components/Menu/context'
import {
Context,
ItemContext,
useMenuContext,
useMenuItemContext,
} from '#/components/Menu/context'
import {
ContextType,
GroupProps,
Expand All @@ -25,10 +30,6 @@ export {
useDialogControl as useMenuControl,
} from '#/components/Dialog'

export function useMemoControlContext() {
return React.useContext(Context)
}

export function Root({
children,
control,
Expand All @@ -47,7 +48,7 @@ export function Root({
}

export function Trigger({children, label, role = 'button'}: TriggerProps) {
const {control} = React.useContext(Context)
const context = useMenuContext()
const {state: focused, onIn: onFocus, onOut: onBlur} = useInteractionState()
const {
state: pressed,
Expand All @@ -57,14 +58,14 @@ export function Trigger({children, label, role = 'button'}: TriggerProps) {

return children({
isNative: true,
control,
control: context.control,
state: {
hovered: false,
focused,
pressed,
},
props: {
onPress: control.open,
onPress: context.control.open,
onFocus,
onBlur,
onPressIn,
Expand All @@ -82,7 +83,7 @@ export function Outer({
showCancel?: boolean
style?: StyleProp<ViewStyle>
}>) {
const context = React.useContext(Context)
const context = useMenuContext()
const {_} = useLingui()

return (
Expand All @@ -105,7 +106,7 @@ export function Outer({

export function Item({children, label, style, onPress, ...rest}: ItemProps) {
const t = useTheme()
const {control} = React.useContext(Context)
const context = useMenuContext()
const {state: focused, onIn: onFocus, onOut: onBlur} = useInteractionState()
const {
state: pressed,
Expand All @@ -121,10 +122,9 @@ export function Item({children, label, style, onPress, ...rest}: ItemProps) {
onFocus={onFocus}
onBlur={onBlur}
onPress={async e => {
await onPress(e)
if (!e.defaultPrevented) {
control?.close()
}
context.control.close(() => {
onPress?.(e)
})
}}
onPressIn={e => {
onPressIn()
Expand Down Expand Up @@ -156,7 +156,7 @@ export function Item({children, label, style, onPress, ...rest}: ItemProps) {

export function ItemText({children, style}: ItemTextProps) {
const t = useTheme()
const {disabled} = React.useContext(ItemContext)
const {disabled} = useMenuItemContext()
return (
<Text
numberOfLines={1}
Expand All @@ -177,7 +177,7 @@ export function ItemText({children, style}: ItemTextProps) {

export function ItemIcon({icon: Comp}: ItemIconProps) {
const t = useTheme()
const {disabled} = React.useContext(ItemContext)
const {disabled} = useMenuItemContext()
return (
<Comp
size="lg"
Expand Down Expand Up @@ -223,15 +223,15 @@ export function Group({children, style}: GroupProps) {

function Cancel() {
const {_} = useLingui()
const {control} = React.useContext(Context)
const context = useMenuContext()

return (
<Button
label={_(msg`Close this dialog`)}
size="small"
variant="ghost"
color="secondary"
onPress={() => control.close()}>
onPress={() => context.control.close()}>
<ButtonText>
<Trans>Cancel</Trans>
</ButtonText>
Expand Down
19 changes: 10 additions & 9 deletions src/components/Menu/index.web.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,12 @@ import * as DropdownMenu from '@radix-ui/react-dropdown-menu'
import {atoms as a, flatten, useTheme, web} from '#/alf'
import * as Dialog from '#/components/Dialog'
import {useInteractionState} from '#/components/hooks/useInteractionState'
import {Context, ItemContext} from '#/components/Menu/context'
import {
Context,
ItemContext,
useMenuContext,
useMenuItemContext,
} from '#/components/Menu/context'
import {
ContextType,
GroupProps,
Expand Down Expand Up @@ -40,10 +45,6 @@ export function useMenuControl(): Dialog.DialogControlProps {
)
}

export function useMemoControlContext() {
return React.useContext(Context)
}

export function Root({
children,
control,
Expand Down Expand Up @@ -110,7 +111,7 @@ const RadixTriggerPassThrough = React.forwardRef(
RadixTriggerPassThrough.displayName = 'RadixTriggerPassThrough'

export function Trigger({children, label, role = 'button'}: TriggerProps) {
const {control} = React.useContext(Context)
const {control} = useMenuContext()
const {
state: hovered,
onIn: onMouseEnter,
Expand Down Expand Up @@ -203,7 +204,7 @@ export function Outer({

export function Item({children, label, onPress, ...rest}: ItemProps) {
const t = useTheme()
const {control} = React.useContext(Context)
const {control} = useMenuContext()
const {
state: hovered,
onIn: onMouseEnter,
Expand Down Expand Up @@ -262,7 +263,7 @@ export function Item({children, label, onPress, ...rest}: ItemProps) {

export function ItemText({children, style}: ItemTextProps) {
const t = useTheme()
const {disabled} = React.useContext(ItemContext)
const {disabled} = useMenuItemContext()
return (
<Text
style={[
Expand All @@ -279,7 +280,7 @@ export function ItemText({children, style}: ItemTextProps) {

export function ItemIcon({icon: Comp, position = 'left'}: ItemIconProps) {
const t = useTheme()
const {disabled} = React.useContext(ItemContext)
const {disabled} = useMenuItemContext()
return (
<View
style={[
Expand Down
Loading

0 comments on commit 26bff1a

Please sign in to comment.