diff --git a/apps/mobile/App.tsx b/apps/mobile/App.tsx index e4242bc2..0cb834b6 100644 --- a/apps/mobile/App.tsx +++ b/apps/mobile/App.tsx @@ -4,11 +4,14 @@ import 'expo-dev-client' import { useMemo, useState } from 'react' +import { useNavigation, useRoute } from '@react-navigation/native' import { createNativeStackNavigator } from '@react-navigation/native-stack' -import { Heading } from '@status-im/components' +import { Heading, IconButton, Paragraph } from '@status-im/components' import { Avatar } from '@status-im/components/src/avatar' +import { ArrowLeftIcon, MembersIcon } from '@status-im/icons/20' import { Stack as View, TamaguiProvider } from '@tamagui/core' import { useFonts } from 'expo-font' +import { Platform } from 'react-native' import { SafeAreaProvider } from 'react-native-safe-area-context' import { AnimatePresence } from 'tamagui' @@ -17,7 +20,34 @@ import { ChannelScreen } from './screens/channel' import { HomeScreen } from './screens/home' import tamaguiConfig from './tamagui.config' -const Stack = createNativeStackNavigator() +import type { RouteProp } from '@react-navigation/native' +import type { HeaderBackButtonProps } from '@react-navigation/native-stack/lib/typescript/src/types' + +export type RootStackParamList = { + Home: undefined + Channel: { channelId: string } +} + +const Stack = createNativeStackNavigator() + +const CustomHeaderLeft = (props: HeaderBackButtonProps) => { + const navigation = useNavigation() + const route = useRoute>() + + return ( + <> + } + onPress={() => { + props.canGoBack && navigation.goBack() + }} + /> + + # {route.params.channelId || 'channel'} + + + ) +} export default function App() { const [position, setPosition] = useState(0) @@ -49,13 +79,16 @@ export default function App() { - + ( + }, + headerRight() { + return ( + } + onPress={() => { + // noop + }} + /> + ) + }, + }} /> diff --git a/apps/mobile/app.json b/apps/mobile/app.json index 4f702f64..de9cecc1 100644 --- a/apps/mobile/app.json +++ b/apps/mobile/app.json @@ -1,8 +1,8 @@ { "expo": { "name": "mobile", - "slug": "mobile", - "version": "1.0.0", + "slug": "status-poc", + "version": "1.0.2", "orientation": "portrait", "icon": "./assets/icon.png", "userInterfaceStyle": "light", @@ -16,16 +16,24 @@ }, "assetBundlePatterns": ["**/*"], "ios": { - "supportsTablet": true + "supportsTablet": true, + "bundleIdentifier": "com.marcelines.statuspoc" }, "android": { "adaptiveIcon": { "foregroundImage": "./assets/adaptive-icon.png", "backgroundColor": "#FFFFFF" - } + }, + "package": "com.marcelines.statuspoc" }, "web": { "favicon": "./assets/favicon.png" - } + }, + "extra": { + "eas": { + "projectId": "e214cc8a-4e7e-4850-8a41-e280ca3a4469" + } + }, + "owner": "marcelines" } } diff --git a/apps/mobile/assets/adaptive-icon.png b/apps/mobile/assets/adaptive-icon.png index 03d6f6b6..6b86d0e1 100644 Binary files a/apps/mobile/assets/adaptive-icon.png and b/apps/mobile/assets/adaptive-icon.png differ diff --git a/apps/mobile/assets/icon.png b/apps/mobile/assets/icon.png index a0b1526f..3cf4dd94 100644 Binary files a/apps/mobile/assets/icon.png and b/apps/mobile/assets/icon.png differ diff --git a/apps/mobile/assets/splash.png b/apps/mobile/assets/splash.png index 0e89705a..7c9e8812 100644 Binary files a/apps/mobile/assets/splash.png and b/apps/mobile/assets/splash.png differ diff --git a/apps/mobile/eas.json b/apps/mobile/eas.json new file mode 100644 index 00000000..18ead6d2 --- /dev/null +++ b/apps/mobile/eas.json @@ -0,0 +1,23 @@ +{ + "cli": { + "version": ">= 3.3.2" + }, + "build": { + "development": { + "developmentClient": true, + "distribution": "internal" + }, + "preview": { + "distribution": "internal" + }, + "production": {}, + "simulator": { + "ios": { + "simulator": true + } + } + }, + "submit": { + "production": {} + } +} diff --git a/apps/mobile/package.json b/apps/mobile/package.json index 8fccfefa..c23a7821 100644 --- a/apps/mobile/package.json +++ b/apps/mobile/package.json @@ -6,18 +6,19 @@ "scripts": { "dev": "expo start -c", "ios": "TAMAGUI_TARGET=native yarn expo run:ios", - "android": "TAMAGUI_TARGET=native yarn expo run:android" + "android": "TAMAGUI_TARGET=native yarn expo run:android", + "start": "expo start --dev-client" }, "dependencies": { "@babel/runtime": "^7.18.9", "@react-navigation/native": "^6.1.2", "@react-navigation/native-stack": "^6.9.8", "@status-im/components": "*", - "expo": "^47.0.12", + "expo": "~47.0.12", "expo-constants": "^14.0.2", "expo-dev-client": "^2.0.1", "expo-linear-gradient": "^12.0.1", - "expo-splash-screen": "^0.17.5", + "expo-splash-screen": "~0.17.5", "expo-status-bar": "^1.4.2", "expo-updates": "^0.15.6", "react": "18.1.0", @@ -25,6 +26,7 @@ "react-native": "0.70.5", "react-native-safe-area-context": "4.4.1", "react-native-screens": "~3.18.0", + "react-native-svg": "^13.7.0", "react-native-web": "~0.18.7" }, "devDependencies": { diff --git a/apps/mobile/screens/channel.tsx b/apps/mobile/screens/channel.tsx index a0694f9a..a2cc5e41 100644 --- a/apps/mobile/screens/channel.tsx +++ b/apps/mobile/screens/channel.tsx @@ -1,7 +1,11 @@ // eslint-disable-next-line eslint-comments/disable-enable-pair /* eslint-disable import/namespace */ + +import { useRef } from 'react' + import { Composer, Messages } from '@status-im/components' import { Stack, useTheme } from '@tamagui/core' +import { StatusBar } from 'expo-status-bar' import { Keyboard, KeyboardAvoidingView, @@ -11,22 +15,41 @@ import { import { useSafeAreaInsets } from 'react-native-safe-area-context' import { ScrollView } from 'tamagui' -export const ChannelScreen = () => { +import type { RootStackParamList } from '../App' +import type { NativeStackScreenProps } from '@react-navigation/native-stack' + +type ChannelScreenProps = NativeStackScreenProps + +export const ChannelScreen = ({ route }: ChannelScreenProps) => { const insets = useSafeAreaInsets() const theme = useTheme() + // We need to get the channel name from the route params + const channelName = route.params.channelId + const scrollRef = useRef(null) + return ( - - + + scrollRef.current?.scrollToEnd()} + > + + + + - - + + diff --git a/apps/mobile/screens/home.tsx b/apps/mobile/screens/home.tsx index bd9a6d57..7c1f1bdd 100644 --- a/apps/mobile/screens/home.tsx +++ b/apps/mobile/screens/home.tsx @@ -1,18 +1,27 @@ // eslint-disable-next-line eslint-comments/disable-enable-pair /* eslint-disable import/namespace */ -import { useState } from 'react' import { Sidebar } from '@status-im/components' import { Stack } from '@tamagui/core' import { StatusBar } from 'expo-status-bar' import { ScrollView } from 'tamagui' -export const HomeScreen = ({ navigation, onScroll, isMinimized }) => { - const [selectedChannel, setSelectedChannel] = useState('welcome') +import type { RootStackParamList } from '../App' +import type { NativeStackScreenProps } from '@react-navigation/native-stack' +import type { NativeScrollEvent, NativeSyntheticEvent } from 'react-native' +type HomeScreenProps = NativeStackScreenProps & { + onScroll: (event: NativeSyntheticEvent) => void + isMinimized?: boolean +} + +export const HomeScreen = ({ + navigation, + onScroll, + isMinimized, +}: HomeScreenProps) => { const onChannelPress = (id: string) => { - setSelectedChannel(id) - navigation.navigate('Channel') + navigation.navigate('Channel', { channelId: id }) } return ( @@ -25,7 +34,6 @@ export const HomeScreen = ({ navigation, onScroll, isMinimized }) => { description="Multichain community-centric NFT marketplace. Create, buy and sell your NFTs." membersCount={123} onChannelPress={onChannelPress} - selectedChannel={selectedChannel} /> diff --git a/apps/vite/src/app.tsx b/apps/vite/src/app.tsx index 2a5e7c34..e0853bc4 100644 --- a/apps/vite/src/app.tsx +++ b/apps/vite/src/app.tsx @@ -1,41 +1,35 @@ import { useState } from 'react' import { - Button, - Code, Composer, - Heading, - Label, Messages, - Paragraph, - Shape, Sidebar, SidebarMembers, + Topbar, } from '@status-im/components' import { Stack, styled, TamaguiProvider } from '@tamagui/core' +import { AnimatePresence } from 'tamagui' -// import { AnimatePresence } from 'tamagui' import tamaguiConfig from '../tamagui.config' -import { Topbar } from './components/topbar' type ThemeVars = 'light' | 'dark' -// const AnimatableDrawer = styled(Stack, { -// variants: { -// fromRight: { -// true: { -// x: 500, -// width: 0, -// }, -// }, -// fromLeft: { -// true: { -// x: 500, -// width: 250, -// }, -// }, -// }, -// }) +const AnimatableDrawer = styled(Stack, { + variants: { + fromRight: { + true: { + x: 500, + width: 0, + }, + }, + fromLeft: { + true: { + x: 500, + width: 250, + }, + }, + }, +}) function App() { const [theme, setTheme] = useState('light') @@ -61,6 +55,8 @@ function App() {
setShowMembers(show => !show)} /> @@ -69,12 +65,27 @@ function App() {
- - {showMembers && ( -
- -
- )} + + {showMembers && ( + + + + )} +
) diff --git a/apps/vite/src/components/topbar.tsx b/apps/vite/src/components/topbar.tsx deleted file mode 100644 index 301c6831..00000000 --- a/apps/vite/src/components/topbar.tsx +++ /dev/null @@ -1,44 +0,0 @@ -import { Divider, IconButton, Paragraph } from '@status-im/components' -import { LockedIcon, MembersIcon, OptionsIcon } from '@status-im/icons/20' -import { Stack } from '@tamagui/core' - -type Props = { - membersVisisble: boolean - onMembersPress: () => void -} - -export const Topbar = (props: Props) => { - const { membersVisisble, onMembersPress } = props - - return ( - - - - # random - - - - - Share random funny stuff with the community. Play nice. - - - - - } - selected={membersVisisble} - onPress={onMembersPress} - /> - } /> - - - ) -} diff --git a/package.json b/package.json index f60141d4..6e739b08 100644 --- a/package.json +++ b/package.json @@ -22,7 +22,8 @@ }, "resolutions": { "react": "18.1.0", - "react-dom": "18.1.0" + "react-dom": "18.1.0", + "react-native-svg": "13.4.0" }, "devDependencies": { "@changesets/cli": "^2.23.0", diff --git a/packages/components/src/accordion/accordion.tsx b/packages/components/src/accordion/accordion.tsx index fc3f42bc..42402593 100644 --- a/packages/components/src/accordion/accordion.tsx +++ b/packages/components/src/accordion/accordion.tsx @@ -1,4 +1,4 @@ -import React from 'react' +import React, { useState } from 'react' import { ChevronRightIcon } from '@status-im/icons/20' import { Stack } from '@tamagui/core' @@ -12,21 +12,18 @@ type BaseProps = GetProps type Props = { children: React.ReactElement[] | React.ReactElement - isExpanded: boolean - onToggle?: () => void + initialExpanded: boolean title: string numberOfNewMessages?: number - showNotifications?: boolean } & BaseProps const Accordion = ({ children, - isExpanded, - onToggle, + initialExpanded, title, numberOfNewMessages, - showNotifications, }: Props) => { + const [isExpanded, setIsExpanded] = useState(initialExpanded) return ( setIsExpanded(prev => !prev)} cursor="pointer" py={8} > @@ -70,7 +67,7 @@ const Accordion = ({ - {showNotifications && numberOfNewMessages && ( + {!isExpanded && numberOfNewMessages && ( { shadowRadius={20} borderTopLeftRadius={20} borderTopRightRadius={20} - elevation={0} px={16} pt={8} - pb={12} width="100%" + style={{ + elevation: 10, + }} {...props} > - - - + } transparent /> diff --git a/packages/components/src/divider/divider.tsx b/packages/components/src/divider/divider.tsx index 897d4dd9..7d716678 100644 --- a/packages/components/src/divider/divider.tsx +++ b/packages/components/src/divider/divider.tsx @@ -8,6 +8,7 @@ export const Divider = styled(Stack, { flex: 1, height: '100%', // maxHeight: 0, + maxWidth: 1, width: 1, marginHorizontal: 12, // y: -0.5, diff --git a/packages/components/src/emoji/themed.tsx b/packages/components/src/emoji/themed.tsx index bbd49ca0..e9975b71 100644 --- a/packages/components/src/emoji/themed.tsx +++ b/packages/components/src/emoji/themed.tsx @@ -12,7 +12,7 @@ export function themed(Component: React.ElementType) { { console.log(reactions) return ( - + } selected /> } /> } /> diff --git a/packages/components/src/sidebar/sidebar.tsx b/packages/components/src/sidebar/sidebar.tsx index 67adf7ef..da58c8c7 100644 --- a/packages/components/src/sidebar/sidebar.tsx +++ b/packages/components/src/sidebar/sidebar.tsx @@ -1,5 +1,3 @@ -import { useState } from 'react' - import { GroupIcon } from '@status-im/icons/16' import { Stack } from '@tamagui/core' @@ -35,26 +33,6 @@ const Sidebar = (props: Props) => { onChannelPress, } = props - const communitiesExpandControl = communities.reduce( - (o, key) => ({ ...o, [key.id]: false }), - - {} as Record[] - ) - - const [isExpanded, setIsExpanded] = useState({ - ...communitiesExpandControl, - welcome: true, - community: true, - design: true, - }) - - const handleToggle = (id: string) => { - setIsExpanded(prev => ({ - ...prev, - [id]: !prev[id as keyof typeof isExpanded], - })) - } - return ( { {communities.map(community => ( handleToggle(community.id)} + // This is just for the demo + initialExpanded={community.id === 'welcome'} title={community.title} numberOfNewMessages={community.numberOfNewMessages} - showNotifications={ - !isExpanded[community.id as keyof typeof isExpanded] - } > {community.channels.map((channel, index) => { const isLastChannelOfTheList = diff --git a/packages/components/src/topbar/index.ts b/packages/components/src/topbar/index.ts new file mode 100644 index 00000000..0da38563 --- /dev/null +++ b/packages/components/src/topbar/index.ts @@ -0,0 +1 @@ +export { Topbar } from './topbar' diff --git a/packages/components/src/topbar/topbar.tsx b/packages/components/src/topbar/topbar.tsx new file mode 100644 index 00000000..c9d6c4cb --- /dev/null +++ b/packages/components/src/topbar/topbar.tsx @@ -0,0 +1,71 @@ +import { Divider, IconButton, Paragraph } from '@status-im/components' +import { + ArrowLeftIcon, + LockedIcon, + MembersIcon, + OptionsIcon, +} from '@status-im/icons/20' +import { Stack } from '@tamagui/core' + +type Props = { + membersVisisble: boolean + onMembersPress: () => void + goBack?: () => void + title?: string + description?: string +} + +const Topbar = (props: Props) => { + const { membersVisisble, onMembersPress, goBack, title, description } = props + + return ( + + + + } onPress={() => goBack?.()} /> + + + {title && ( + + {title} + + )} + + + + {description && ( + + {description} + + )} + + + + + } + selected={membersVisisble} + onPress={onMembersPress} + /> + + } /> + + + ) +} + +export { Topbar } diff --git a/packages/components/src/typography/typography.tsx b/packages/components/src/typography/typography.tsx index 21c5b0dc..66981cdc 100644 --- a/packages/components/src/typography/typography.tsx +++ b/packages/components/src/typography/typography.tsx @@ -11,12 +11,12 @@ export const Heading = styled(SizableText, { h1: { fontSize: 27, lineHeight: 32, - letterSpacing: '-0.021em', + letterSpacing: -0.021, }, h2: { fontSize: 19, lineHeight: 26, - letterSpacing: '-0.016em', + letterSpacing: -0.016, }, }, uppercase: { @@ -53,17 +53,17 @@ export const Paragraph = styled(SizableText, { normal: { fontSize: 15, lineHeight: 22, - letterSpacing: '-0.009em', + letterSpacing: -0.009, }, smaller: { fontSize: 13, lineHeight: 18, - letterSpacing: '-0.003em', + letterSpacing: -0.003, }, 11: { fontSize: 11, lineHeight: 18, - letterSpacing: '-0.003em', + letterSpacing: -0.003, }, }, uppercase: { @@ -98,7 +98,7 @@ export const Label = styled(SizableText, { fontSize: 11, lineHeight: 16, - letterSpacing: '-0.005em', + letterSpacing: -0.005, variants: { uppercase: { @@ -132,18 +132,18 @@ export const Code = styled(SizableText, { fontSize: 11, lineHeight: 16, - letterSpacing: '-0.005em', + letterSpacing: -0.005, variants: { normal: { fontSize: 15, lineHeight: 22, - letterSpacing: '-0.009em', + letterSpacing: -0.009, }, smaller: { fontSize: 13, lineHeight: 18, - letterSpacing: '-0.003em', + letterSpacing: -0.003, }, uppercase: { true: { diff --git a/packages/icons/src/arrow-icon.tsx b/packages/icons/src/arrow-icon.tsx new file mode 100644 index 00000000..dc432b9c --- /dev/null +++ b/packages/icons/src/arrow-icon.tsx @@ -0,0 +1,27 @@ +import { memo } from 'react' + +import { themed } from '@status-im/icons/src/themed' +import { Path, Svg } from 'react-native-svg' + +import type { IconProps } from './types' + +function Icon(props: IconProps) { + const { color, size = 20, ...otherProps } = props + + return ( + + + + ) +} + +export const ArrowIcon = memo(themed(Icon)) diff --git a/yarn.lock b/yarn.lock index 69924ebc..fd4f93bb 100644 --- a/yarn.lock +++ b/yarn.lock @@ -10682,10 +10682,10 @@ expo-manifests@~0.4.0: dependencies: expo-json-utils "~0.4.0" -expo-modules-autolinking@1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/expo-modules-autolinking/-/expo-modules-autolinking-1.0.1.tgz#a82eaef2decd1d518458d64cb542c64fc23eacde" - integrity sha512-Ch0K/Vb2W7zSPlPKKFr6dwgwge6sSCpl7XPW8jrc7hUy+M72dvcfsBsaphvGNlKIZM6TtpCt0xbUlL48wI2y1A== +expo-modules-autolinking@1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/expo-modules-autolinking/-/expo-modules-autolinking-1.0.2.tgz#f072f342ab797e43b16ddcdef251fcd4db851e1a" + integrity sha512-skAUXERKw1gtSw8xsvft9DE0KVhBvw4dujAtgCZoG2l513fN7ds+B5+30ZVgZATMC+EjtlmjKXzhp5QS44DCFA== dependencies: chalk "^4.1.0" commander "^7.2.0" @@ -10701,7 +10701,7 @@ expo-modules-core@1.1.1: compare-versions "^3.4.0" invariant "^2.2.4" -expo-splash-screen@^0.17.5: +expo-splash-screen@~0.17.5: version "0.17.5" resolved "https://registry.yarnpkg.com/expo-splash-screen/-/expo-splash-screen-0.17.5.tgz#a18dc59c1cc28ebbedbf0a7529a419d18ab0b311" integrity sha512-ejSO78hwHXz8T9u8kh8t4r6CR4h70iBvA65gX8GK+dYxZl6/IANPbIb2VnUpND9vqfW+JnkDw+ZFst+gDnkpcQ== @@ -10742,10 +10742,10 @@ expo-updates@^0.15.6: resolve-from "^5.0.0" uuid "^3.4.0" -expo@^47.0.12: - version "47.0.12" - resolved "https://registry.yarnpkg.com/expo/-/expo-47.0.12.tgz#2a8b41217e1cb630f84ea3723031d07354289ae7" - integrity sha512-LqECuBpV6arTncksQzOGGQmxOdeQmzm15VqwIJ/c3SWoxiVh5hKf+taUv2oaLmfx2z04TSm1oo56pRSrsL5iIA== +expo@~47.0.12: + version "47.0.13" + resolved "https://registry.yarnpkg.com/expo/-/expo-47.0.13.tgz#f53f82e7f9e209f8a8b25f2493f58439958368cb" + integrity sha512-9VjjGdViCJ9NfWbUE7brkwFBDvKuA35V345vMtHFYNKoGJjXib36yitmawreMDQFv0kMTqTnzc7T2191Pod7Ng== dependencies: "@babel/runtime" "^7.14.0" "@expo/cli" "0.4.11" @@ -10760,7 +10760,7 @@ expo@^47.0.12: expo-file-system "~15.1.1" expo-font "~11.0.1" expo-keep-awake "~11.0.1" - expo-modules-autolinking "1.0.1" + expo-modules-autolinking "1.0.2" expo-modules-core "1.1.1" fbemitter "^3.0.0" getenv "^1.0.0" @@ -15755,10 +15755,10 @@ react-native-screens@~3.18.0: react-freeze "^1.0.0" warn-once "^0.1.0" -react-native-svg@^13.7.0: - version "13.7.0" - resolved "https://registry.yarnpkg.com/react-native-svg/-/react-native-svg-13.7.0.tgz#be2ffb935e996762543dd7376bdc910722f7a43c" - integrity sha512-WR5CIURvee5cAfvMhmdoeOjh1SC8KdLq5u5eFsz4pbYzCtIFClGSkLnNgkMSDMVV5LV0qQa4jeIk75ieIBzaDA== +react-native-svg@13.4.0, react-native-svg@^13.7.0: + version "13.4.0" + resolved "https://registry.yarnpkg.com/react-native-svg/-/react-native-svg-13.4.0.tgz#82399ba0956c454144618aa581e2d748dd3f010a" + integrity sha512-B3TwK+H0+JuRhYPzF21AgqMt4fjhCwDZ9QUtwNstT5XcslJBXC0FoTkdZo8IEb1Sv4suSqhZwlAY6lwOv3tHag== dependencies: css-select "^5.1.0" css-tree "^1.1.3"