From eceef67d466007155718c93e6c2fe2b1afa53175 Mon Sep 17 00:00:00 2001 From: Paul Frazee Date: Mon, 31 Oct 2022 12:17:58 -0500 Subject: [PATCH] WIP scene UIs --- src/state/models/profile-ui.ts | 2 +- src/view/com/profile/ProfileHeader.tsx | 6 +- src/view/com/util/Selector.tsx | 17 +++-- src/view/index.ts | 2 + src/view/lib/icons.tsx | 29 +++++++- src/view/screens/Contacts.tsx | 2 +- src/view/screens/Notifications.tsx | 24 ++++++- src/view/shell/mobile/MainMenu.tsx | 92 +++++++++++++++++++++----- src/view/shell/mobile/index.tsx | 1 + 9 files changed, 144 insertions(+), 31 deletions(-) diff --git a/src/state/models/profile-ui.ts b/src/state/models/profile-ui.ts index 804c21b8..cd29c35d 100644 --- a/src/state/models/profile-ui.ts +++ b/src/state/models/profile-ui.ts @@ -15,7 +15,7 @@ export interface ProfileUiParams { export class ProfileUiModel { // constants - static SELECTOR_ITEMS = ['Posts', 'Badges'] + static SELECTOR_ITEMS = ['Posts', 'Scenes'] // data profile: ProfileViewModel diff --git a/src/view/com/profile/ProfileHeader.tsx b/src/view/com/profile/ProfileHeader.tsx index 594890d1..9565ae4a 100644 --- a/src/view/com/profile/ProfileHeader.tsx +++ b/src/view/com/profile/ProfileHeader.tsx @@ -86,14 +86,16 @@ export const ProfileHeader = observer(function ProfileHeader({ {view.displayName} - + { + undefined /* Employee @blueskyweb.xyz - + */ + } {isMe ? ( + swipeGestureInterp?: SharedValue onSelect?: (index: number) => void }) { const [itemLayouts, setItemLayouts] = useState( @@ -41,26 +43,27 @@ export function Selector({ return [left, middle, right] }, [selectedIndex, itemLayouts]) + const interp = swipeGestureInterp || DEFAULT_SWIPE_GESTURE_INTERP const underlinePos = useAnimatedStyle(() => { const other = - swipeGestureInterp.value === 0 + interp.value === 0 ? currentLayouts[1] - : swipeGestureInterp.value < 0 + : interp.value < 0 ? currentLayouts[0] : currentLayouts[2] return { left: interpolate( - Math.abs(swipeGestureInterp.value), + Math.abs(interp.value), [0, 1], [currentLayouts[1].x, other.x], ), width: interpolate( - Math.abs(swipeGestureInterp.value), + Math.abs(interp.value), [0, 1], [currentLayouts[1].width, other.width], ), } - }, [currentLayouts, swipeGestureInterp]) + }, [currentLayouts, interp]) const onLayout = () => { const promises = [] @@ -112,7 +115,7 @@ const styles = StyleSheet.create({ backgroundColor: colors.white, }, item: { - marginRight: 20, + marginRight: 14, paddingHorizontal: 10, }, itemLabel: { diff --git a/src/view/index.ts b/src/view/index.ts index fb63f565..92757f35 100644 --- a/src/view/index.ts +++ b/src/view/index.ts @@ -19,6 +19,7 @@ import {faCheck} from '@fortawesome/free-solid-svg-icons/faCheck' import {faCircleUser} from '@fortawesome/free-regular-svg-icons/faCircleUser' import {faClone} from '@fortawesome/free-regular-svg-icons/faClone' import {faComment} from '@fortawesome/free-regular-svg-icons/faComment' +import {faCompass} from '@fortawesome/free-regular-svg-icons/faCompass' import {faEllipsis} from '@fortawesome/free-solid-svg-icons/faEllipsis' import {faEnvelope} from '@fortawesome/free-solid-svg-icons/faEnvelope' import {faExclamation} from '@fortawesome/free-solid-svg-icons/faExclamation' @@ -69,6 +70,7 @@ export function setup() { faCircleUser, faClone, faComment, + faCompass, faEllipsis, faEnvelope, faExclamation, diff --git a/src/view/lib/icons.tsx b/src/view/lib/icons.tsx index 6e6bcb77..114ae532 100644 --- a/src/view/lib/icons.tsx +++ b/src/view/lib/icons.tsx @@ -33,12 +33,37 @@ export function GridIcon({style}: {style?: StyleProp}) { export function HomeIcon({style}: {style?: StyleProp}) { return ( - + ) } + +// Copyright (c) 2020 Refactoring UI Inc. +// https://github.com/tailwindlabs/heroicons/blob/master/LICENSE +export function UserGroupIcon({style}: {style?: StyleProp}) { + return ( + + + + ) +} diff --git a/src/view/screens/Contacts.tsx b/src/view/screens/Contacts.tsx index 7c079cde..70b15a86 100644 --- a/src/view/screens/Contacts.tsx +++ b/src/view/screens/Contacts.tsx @@ -43,7 +43,7 @@ export const Contacts = ({visible, params}: ScreenParams) => { diff --git a/src/view/screens/Notifications.tsx b/src/view/screens/Notifications.tsx index fac39acd..e33a34c2 100644 --- a/src/view/screens/Notifications.tsx +++ b/src/view/screens/Notifications.tsx @@ -1,6 +1,7 @@ import React, {useState, useEffect} from 'react' -import {View} from 'react-native' +import {StyleSheet, Text, View} from 'react-native' import {Feed} from '../com/notifications/Feed' +import {colors} from '../lib/styles' import {useStores} from '../../state' import {NotificationsViewModel} from '../../state/models/notifications-view' import {ScreenParams} from '../routes' @@ -35,5 +36,24 @@ export const Notifications = ({visible}: ScreenParams) => { } }, [visible, store]) - return {notesView && } + return ( + + + Notifications + + {notesView && } + + ) } + +const styles = StyleSheet.create({ + header: { + backgroundColor: colors.white, + }, + title: { + fontSize: 30, + fontWeight: 'bold', + paddingHorizontal: 12, + paddingVertical: 6, + }, +}) diff --git a/src/view/shell/mobile/MainMenu.tsx b/src/view/shell/mobile/MainMenu.tsx index 18b68d5a..ee09d4aa 100644 --- a/src/view/shell/mobile/MainMenu.tsx +++ b/src/view/shell/mobile/MainMenu.tsx @@ -2,6 +2,7 @@ import React, {useEffect} from 'react' import {observer} from 'mobx-react-lite' import { Image, + ImageSourcePropType, StyleSheet, SafeAreaView, Text, @@ -17,7 +18,7 @@ import Animated, { } from 'react-native-reanimated' import {IconProp} from '@fortawesome/fontawesome-svg-core' import {FontAwesomeIcon} from '@fortawesome/react-native-fontawesome' -import {HomeIcon} from '../../lib/icons' +import {HomeIcon, UserGroupIcon} from '../../lib/icons' import {useStores} from '../../../state' import {s, colors} from '../../lib/styles' import {DEF_AVATER} from '../../lib/assets' @@ -68,7 +69,9 @@ export const MainMenu = observer( onPress={() => onNavigate(url)}> {icon === 'home' ? ( - + + ) : icon === 'user-group' ? ( + ) : ( ) + const MenuItemImage = ({ + img, + label, + url, + count, + }: { + img: ImageSourcePropType + label: string + url: string + count?: number + }) => ( + onNavigate(url)}> + + {count ? ( + + {count} + + ) : undefined} + + {label} + + + ) + if (!active) { return } @@ -118,22 +147,41 @@ export const MainMenu = observer( /> - - + + - - - + + + Scenes + + + + + + + + + + + @@ -168,6 +216,13 @@ const styles = StyleSheet.create({ section: { paddingHorizontal: 10, }, + heading: { + fontSize: 21, + fontWeight: 'bold', + paddingHorizontal: 10, + paddingTop: 6, + paddingBottom: 12, + }, profile: { paddingVertical: 10, @@ -194,16 +249,20 @@ const styles = StyleSheet.create({ menuItems: { flexDirection: 'row', - marginTop: 10, - marginBottom: 10, + marginBottom: 20, }, menuItem: { - width: 80, + width: 82, alignItems: 'center', - marginRight: 6, }, menuItemMargin: { - marginRight: 14, + marginRight: 10, + }, + menuItemImg: { + borderRadius: 30, + width: 60, + height: 60, + marginBottom: 5, }, menuItemIconWrapper: { borderRadius: 6, @@ -219,6 +278,7 @@ const styles = StyleSheet.create({ }, menuItemLabel: { fontSize: 13, + textAlign: 'center', }, menuItemCount: { position: 'absolute', diff --git a/src/view/shell/mobile/index.tsx b/src/view/shell/mobile/index.tsx index 73252796..873fd655 100644 --- a/src/view/shell/mobile/index.tsx +++ b/src/view/shell/mobile/index.tsx @@ -388,6 +388,7 @@ const styles = StyleSheet.create({ color: colors.white, }, ctrlIcon: { + color: colors.black, marginLeft: 'auto', marginRight: 'auto', },