Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mobile context menu #122

Draft
wants to merge 64 commits into
base: dev
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 48 commits
Commits
Show all changes
64 commits
Select commit Hold shift + click to select a range
87b425b
Nativewind config confirmed by verifyInstallation()
thomasgwatson Jan 7, 2025
6cb75ff
Starting to split the drawer nav between GlobalNav and ContextMenu
thomasgwatson Jan 8, 2025
86afcd2
Merge branch 'dev' into mobile-context-menu
thomasgwatson Jan 8, 2025
2e84afb
Merge branch 'dev' into mobile-context-menu
thomasgwatson Jan 8, 2025
c9fc0e9
Add key to globalNav list items
thomasgwatson Jan 8, 2025
8137c2d
GlobalNav updates WIP
thomasgwatson Jan 10, 2025
36a2ab8
Merge branch 'dev' into mobile-context-menu
thomasgwatson Jan 10, 2025
e71535b
Allow nav to myHome via bottomNavTab. Use context widgets for myHome …
thomasgwatson Jan 11, 2025
203130f
Merge branch 'dev' into mobile-context-menu
thomasgwatson Jan 11, 2025
5cc9d09
Merge branch 'urql-poc' into mobile-context-menu
thomasgwatson Jan 11, 2025
d78dd73
Merge branch 'dev' into mobile-context-menu
thomasgwatson Jan 12, 2025
000082a
Fix busted bracket
thomasgwatson Jan 15, 2025
bcd0aca
Merge branch 'dev' into mobile-context-menu
thomasgwatson Jan 15, 2025
ecede9e
Merge branch 'urql-poc' into mobile-context-menu
thomasgwatson Jan 15, 2025
ca441e7
Add widget titles to locales
thomasgwatson Jan 15, 2025
10e91c9
Add lucide icons. Add nativewind themes config. Add CSS variables for…
thomasgwatson Jan 16, 2025
a7712b4
Merge branch 'dev' into mobile-context-menu
thomasgwatson Jan 16, 2025
71e0ff9
Add Luxon as dependency to mobile
thomasgwatson Jan 16, 2025
ff71c8b
Flesh out context menu items for mobile
thomasgwatson Jan 16, 2025
214cf94
wip
thomasgwatson Jan 16, 2025
5b5d4f2
Merge branch 'dev' into mobile-context-menu
thomasgwatson Jan 16, 2025
c58f3da
Merge branch 'urql-poc' into mobile-context-menu
thomasgwatson Jan 17, 2025
2353e3f
Merge fixes and ensuring Android builds
thomasgwatson Jan 17, 2025
8af2ce9
Add homeWidget to Group graphQL interface
thomasgwatson Jan 17, 2025
0758434
Add homeWidget to graphql fragments. Tweak widget helpers. WIP on nav…
thomasgwatson Jan 17, 2025
a2864a9
Merge branch 'dev' into mobile-context-menu
thomasgwatson Jan 17, 2025
45cd04b
Merge branch 'urql-poc' into mobile-context-menu
thomasgwatson Jan 18, 2025
ee888eb
Added pager-view
thomasgwatson Jan 18, 2025
a80358c
Merge branch 'dev' into mobile-context-menu
thomasgwatson Jan 18, 2025
8e55708
Merge branch 'urql-poc' into mobile-context-menu
thomasgwatson Jan 18, 2025
7f2b9e2
Add basic all view to the mobile context menu
thomasgwatson Jan 19, 2025
608a202
Just use navigation.navigate for navigation. Several links/navigation…
thomasgwatson Jan 20, 2025
b5be525
Merge branch 'urql-poc' into mobile-context-menu
thomasgwatson Jan 20, 2025
19a7f76
Merge branch 'urql-poc' into mobile-context-menu
thomasgwatson Jan 20, 2025
ce86161
Somehow the webView was crashing without this undefined guard
thomasgwatson Jan 20, 2025
55966ab
Merge branch 'urql-poc' into mobile-context-menu
thomasgwatson Jan 20, 2025
e9530b3
Podlocccck
thomasgwatson Jan 20, 2025
3b31d72
Cleanup
thomasgwatson Jan 20, 2025
8b2b3bf
Fix unnecessary render of childPost notice on my context posts
thomasgwatson Jan 20, 2025
310e5cf
Correct an import on FlagContent
thomasgwatson Jan 20, 2025
f882b87
Merge branch 'urql-poc' into mobile-context-menu
thomasgwatson Jan 20, 2025
393ed6a
Merge branch 'dev' into mobile-context-menu
thomasgwatson Jan 21, 2025
47a7581
Go away
thomasgwatson Jan 21, 2025
26521bf
Correct default context for widgetUrl function
thomasgwatson Jan 21, 2025
fd98425
Add logout functionality to my Context Menu
thomasgwatson Jan 21, 2025
e4d0024
Extending GlobalNav
thomasgwatson Jan 21, 2025
35b333a
Merge branch 'dev' into mobile-context-menu
lorenjohnson Jan 21, 2025
1baed52
Merge branch 'mobile-context-menu' of https://github.com/Hylozoic/hyl…
thomasgwatson Jan 21, 2025
c45be24
Merge branch 'dev' into mobile-context-menu
lorenjohnson Jan 21, 2025
8496bf2
chore(mobile): Fix some things with WIP new nav and design, add comments
lorenjohnson Jan 21, 2025
60e4e5b
Merge branch 'mobile-context-menu' of https://github.com/Hylozoic/hyl…
thomasgwatson Jan 21, 2025
8d3570e
Merge branch 'dev' into mobile-context-menu
thomasgwatson Jan 21, 2025
69a642a
Tweaks of Loren tweaks
thomasgwatson Jan 22, 2025
e7b9cfe
Merge branch 'dev' into mobile-context-menu
thomasgwatson Jan 22, 2025
2875b67
chore(mobile): openURL / Linking debugging
lorenjohnson Jan 22, 2025
35e1298
chore(mobile): Adds some documentation and debugging to useOpenURL / …
lorenjohnson Jan 22, 2025
df7faa3
chore(mobile): Fix AllView usage of shared helpers
lorenjohnson Jan 22, 2025
259bd5f
Ransack tab bar navigator
thomasgwatson Jan 23, 2025
623e508
Merge branch 'mobile-context-menu' of https://github.com/Hylozoic/hyl…
thomasgwatson Jan 23, 2025
0338074
Merge branch 'dev' into mobile-context-menu
thomasgwatson Jan 23, 2025
aac4442
Clean up double import post branch-merge
thomasgwatson Jan 23, 2025
91b41d5
Merge branch 'locales-mobile' into mobile-context-menu
thomasgwatson Jan 23, 2025
7a84ae4
Merge branch 'dev' into mobile-context-menu
thomasgwatson Jan 23, 2025
652cb5f
Merge branch 'dev' into mobile-context-menu
thomasgwatson Jan 26, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions apps/backend/api/graphql/makeModels.js
Original file line number Diff line number Diff line change
Expand Up @@ -463,6 +463,7 @@ export default function makeModels (userId, isAdmin, apiClient) {
'banner_url',
'created_at',
'description',
'homeWidget',
'location',
'geo_shape',
'memberCount',
Expand Down Expand Up @@ -615,6 +616,7 @@ export default function makeModels (userId, isAdmin, apiClient) {
],
getters: {
// commonRoles: async g => g.commonRoles(),
homeWidget: g => g.homeWidget(),
invitePath: g =>
GroupMembership.hasResponsibility(userId, g, Responsibility.constants.RESP_ADD_MEMBERS)
.then(canInvite => canInvite ? Frontend.Route.invitePath(g) : null),
Expand Down
2 changes: 2 additions & 0 deletions apps/backend/api/graphql/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -676,6 +676,8 @@ type Group {
description: String
# A geoJSON object outlining a geographic shape describing the border/boundaries of the group in the world
geoShape: JSON
# home widget
homeWidget: ContextWidget
# The current invite link for this group
invitePath: String
# A string describing the physical location of this group in the world
Expand Down
20 changes: 19 additions & 1 deletion apps/backend/api/models/Group.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ module.exports = bookshelf.Model.extend(merge({
},

contextWidgets () {
return this.hasMany(ContextWidget) // TODO CONTEXT: sometimes we want all widgets, sometimes only want the ordered ones. need to handle this
return this.hasMany(ContextWidget)
},

creator: function () {
Expand Down Expand Up @@ -143,6 +143,24 @@ module.exports = bookshelf.Model.extend(merge({
})
},

homeWidget () {
return ContextWidget.query(q => {
q.with('home_widget', qb => {
qb.from('context_widgets')
.where({
group_id: this.id,
type: 'home'
})
.select('id')
})
.from('context_widgets')
.whereRaw('parent_id = (select id from home_widget)')
.andWhere('group_id', this.id)
.orderBy('order', 'asc')
.limit(1)
}).fetch()
},

isHidden() {
return this.get('visibility') === Group.Visibility.HIDDEN
},
Expand Down
5 changes: 3 additions & 2 deletions apps/mobile/babel.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module.exports = {
presets: ['module:@react-native/babel-preset'],
presets: ['module:@react-native/babel-preset', 'nativewind/babel'],
plugins: [
[
'module-resolver',
Expand All @@ -23,7 +23,8 @@ module.exports = {
}
],
'import-graphql',
'react-native-reanimated/plugin'
'react-native-reanimated/plugin',
['@babel/plugin-syntax-decorators', { 'version': '2023-11' }]
],
env: {
test: {
Expand Down
1 change: 1 addition & 0 deletions apps/mobile/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import VersionCheck from 'components/VersionCheck'
import RootNavigator from 'navigation/RootNavigator'
import './i18n'
import 'intl-pluralrules'
import './src/style/global.css'
import { ActionSheetProvider } from '@expo/react-native-action-sheet'
import { baseStyle, tagsStyles, classesStyles } from 'components/HyloHTML/HyloHTML.styles'

Expand Down
42 changes: 42 additions & 0 deletions apps/mobile/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@
"Lets get started!": "Let's get started!",
"Link to group agreements": "Link to group agreements",
"Link to platform agreements": "Link to platform agreements",
"Loading...": "Loading...",
"Location": "Location",
"Log In": "Log In",
"Log in now": "Log in now",
Expand Down Expand Up @@ -312,6 +313,47 @@
"Who can see this group": "",
"Who can see this group?": "Who can see this group?",
"Why was this": "Why was this",
"widget-about": "About",
"widget-all": "All",
"widget-ask-and-offer": "Ask And Offer",
"widget-auto-view": "What's happening",
"widget-chats": "Chats",
"widget-custom-views": "Custom Views",
"widget-decisions": "Decisions",
"widget-discussions": "Discussions",
"widget-events": "Events",
"widget-groups": "Groups",
"widget-hearth": "Hearth",
"widget-home": "Home",
"widget-map": "Map",
"widget-members": "Members",
"widget-my-account": "Account",
"widget-my-all": "All My Group's Posts",
"widget-my-announcements": "Announcements",
"widget-my-content": "My Content",
"widget-my-edit-profile": "Edit Profile",
"widget-my-groups": "My Groups",
"widget-my-groups-content": "My Group's Content",
"widget-my-groups-events": "My Group's Events",
"widget-my-groups-map": "My Group's Map",
"widget-my-groups-stream": "My Group's Stream",
"widget-my-interactions": "My Interactions",
"widget-my-invites": "My Invites",
"widget-my-locale": "Language/Locale",
"widget-my-logout": "Logout",
"widget-my-mentions": "Mentions",
"widget-my-notifications": "Notifications",
"widget-my-posts": "My Posts",
"widget-my-profile": "My Profile",
"widget-my-saved-searches": "Saved Searches",
"widget-myself": "My Account",
"widget-projects": "Projects",
"widget-public-events": "Public Events",
"widget-public-groups": "Group Explorer",
"widget-public-map": "Public Map",
"widget-public-stream": "Public Stream",
"widget-setup": "Setup",
"widget-stream": "Stream",
"Write a comment": "Write a comment...",
"Write something": "Write something...",
"Yes": "Yes",
Expand Down
42 changes: 42 additions & 0 deletions apps/mobile/locales/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@
"Lets get started!": "¡Empecemos!",
"Link to group agreements": "Enlace a acuerdos de grupo",
"Link to platform agreements": "Enlace a acuerdos de plataforma",
"Loading...": "Cargando...",
"Location": "Ubicación",
"Log In": "Acceso",
"Log in now": "Inicia sesión ahora",
Expand Down Expand Up @@ -365,6 +366,47 @@
"status-active": "Estado: Activo",
"status-cleared": "Estado: Borrado por el moderador",
"we just need to know your name and password and youre account will be created": "sólo necesitamos saber su nombre y contraseña y se creará su cuenta",
"widget-about": "Acerca De",
"widget-all": "Todos",
"widget-ask-and-offer": "Pedir Y Ofrecer",
"widget-auto-view": "Qué Está Pasando",
"widget-chats": "Chats",
"widget-custom-views": "Vistas Personalizadas",
"widget-decisions": "Decisiones",
"widget-discussions": "Discusiones",
"widget-events": "Eventos",
"widget-groups": "Grupos",
"widget-hearth": "Hogar",
"widget-home": "Inicio",
"widget-map": "Mapa",
"widget-members": "Miembros",
"widget-my-account": "Cuenta",
"widget-my-all": "Todas Las Publicaciones",
"widget-my-announcements": "Anuncios",
"widget-my-content": "Mi Contenido",
"widget-my-edit-profile": "Editar Perfil",
"widget-my-groups": "Mis Grupos",
"widget-my-groups-content": "Contenido de Mis Grupos",
"widget-my-groups-events": "Eventos de Mis Grupos",
"widget-my-groups-map": "Mapa de Mis Grupos",
"widget-my-groups-stream": "Flujo de Mis Grupos",
"widget-my-interactions": "Mis Interacciones",
"widget-my-invites": "Mis Invitaciones",
"widget-my-locale": "Idioma/Región",
"widget-my-logout": "Cerrar Sesión",
"widget-my-mentions": "Menciones",
"widget-my-notifications": "Notificaciones",
"widget-my-posts": "Mis Publicaciones",
"widget-my-profile": "Perfil",
"widget-my-saved-searches": "Búsquedas Guardadas",
"widget-myself": "Mi Cuenta",
"widget-projects": "Proyectos",
"widget-public-events": "Eventos Públicos",
"widget-public-groups": "Explorador de Grupos",
"widget-public-map": "Mapa Público",
"widget-public-stream": "Flujo Público",
"widget-setup": "Configuración",
"widget-stream": "Flujo",
"welcome page backup text": "Tómese un momento para explorar y ver qué hay vivo en nuestro grupo.\n \n Preséntate haciendo clic en Crear y publicando una discusión para compartir quién eres y qué te trae aquí.\n \n No olvide completar nuestro perfil para que personas con ideas afines puedan conectarse con usted.",
"{{childGroupsLength}} Group(s) are a part of {{currentGroupName}}": "Los grupos {{childGroupsLength}} son parte de {{currentGroupName}}",
"{{currentGroupName}} is a part of {{parentGroupsLength}} Group(s)": "{{currentGroupName}} es parte de {{parentGroupsLength}} grupo(s)"
Expand Down
3 changes: 2 additions & 1 deletion apps/mobile/metro.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
const path = require('path');
const { getDefaultConfig, mergeConfig } = require('@react-native/metro-config');
const { withNativeWind } = require("nativewind/metro");

/**
* Metro configuration
Expand Down Expand Up @@ -31,4 +32,4 @@ const config = {
]
};

module.exports = mergeConfig(getDefaultConfig(__dirname), config);
module.exports = withNativeWind(mergeConfig(getDefaultConfig(__dirname), config), { input: path.resolve(__dirname, './src/style/global.css') });
3 changes: 3 additions & 0 deletions apps/mobile/nativewind-env.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/// <reference types="nativewind/types" />

// NOTE: This file should not be edited and should be committed with your source code. It is generated by NativeWind.
7 changes: 7 additions & 0 deletions apps/mobile/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"pod-install": "cd ios && pod install"
},
"dependencies": {
"@babel/plugin-syntax-decorators": "^7.25.9",
"@emoji-mart/data": "^1.2.1",
"@emoji-mart/react": "^1.1.1",
"@expo/react-native-action-sheet": "^4.1.0",
Expand All @@ -44,6 +45,7 @@
"@urql/devtools": "^2.0.3",
"@urql/exchange-graphcache": "^7.2.1",
"babel-plugin-import-graphql": "^2.8.1",
"clsx": "2.1.1",
"cross-fetch": "^4.1.0",
"emoji-datasource-apple": "^15.1.2",
"emoji-mart": "^5.6.0",
Expand All @@ -53,9 +55,11 @@
"i18next": "^23.12.2",
"intl-pluralrules": "^2.0.1",
"lodash": "^4.17.21",
"lucide-react-native": "0.471.0",
"luxon": "^3.5.0",
"mixpanel-react-native": "^3.0.8",
"moment-timezone": "^0.5.46",
"nativewind": "^4.1.23",
"path-to-regexp": "^6.2.2",
"prettier": "2.8.8",
"prop-types": "^15.8.1",
Expand Down Expand Up @@ -88,6 +92,7 @@
"react-native-reanimated": "3.16.7",
"react-native-render-html": "patch:react-native-render-html@npm:6.3.4#.yarn/patches/react-native-render-html+6.3.4.patch",
"react-native-restart": "^0.0.27",
"react-native-root-toast": "^3.6.0",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove

"react-native-safe-area-context": "^5.1.0",
"react-native-screens": "^4.5.0",
"react-native-share": "^12.0.3",
Expand All @@ -105,6 +110,7 @@
"reselect": "^4.1.6",
"sails.io.js": "^1.2.1",
"socket.io-client": "2.3.1",
"tailwindcss": "^3.4.17",
"tinycolor2": "^1.6.0",
"urql": "^4.2.1"
},
Expand Down Expand Up @@ -154,6 +160,7 @@
"redux-logger": "^3.0.6",
"reselect-tools": "^0.0.7",
"standard": "^17.1.2",
"tailwind-merge": "^2.5.4",
"timezone-mock": "^1.3.6",
"typescript": "5.0.4",
"validator": "^13.12.0"
Expand Down
100 changes: 100 additions & 0 deletions apps/mobile/src/components/GroupMenuHeader/GroupMenuHeader.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
import React, { useState, useEffect } from 'react'
import { Settings, Users, ChevronRight } from 'lucide-react-native'
import { View, Text, TouchableOpacity } from 'react-native'
import { useTranslation } from 'react-i18next'
import { useNavigation } from '@react-navigation/native'
import FastImage from 'react-native-fast-image'
import Avatar from 'components/Avatar'
import { RESP_ADMINISTRATION } from 'store/constants'
// import { DEFAULT_BANNER, DEFAULT_AVATAR } from 'store/models/Group'
import useHasResponsibility from 'hooks/useHasResponsibility'
import { cn } from '../../util'

export default function GroupMenuHeader ({ group }) {
const { t } = useTranslation()
const navigation = useNavigation()
const avatarUrl = group.avatarUrl
const bannerUrl = group.bannerUrl
const [textColor, setTextColor] = useState('background')
const hasResponsibility = useHasResponsibility({ forCurrentGroup: true, forCurrentUser: true })
const canAdmin = hasResponsibility(RESP_ADMINISTRATION)

useEffect(() => {
/*
TODO: Web has a bunch of code that checks the color of the group background
image to select a good constrasting color for the text.

Its very dependent on the DOM, so need to consider a different option for mobile
*/
setTextColor('primary-foreground')
}, [bannerUrl])

return (
<View className='relative flex flex-col justify-end h-[140px] shadow-md pb-2' testID='group-header'>
<FastImage
source={{ uri: bannerUrl }}
style={{
height: 146,
width: '100%',
position: 'absolute',
opacity: 0.8,
}}
/>

{canAdmin && (
<View className='absolute top-2 right-2'>
<TouchableOpacity
// TODO redesign: make this actually navigate correctly
onPress={() => navigation.navigate('Group Settings')}
>
<View className='w-6 h-6 drop-shadow-md'>
<Settings color='white' size={24}/>
</View>
</TouchableOpacity>
</View>
)}

<View className='relative flex flex-row items-center text-background ml-2 mr-2 gap-1'>
<FastImage
source={{ uri: avatarUrl }}
style={{
height: 36,
width: 36,
marginRight: 6,
borderRadius: 4
}}
/>

<View className={cn(
'flex flex-col flex-1',
`text-${textColor} drop-shadow-md`
)}>
<Text className='text-xl font-bold m-0 text-white'>
{group.name}
</Text>

<TouchableOpacity
onPress={() => navigation.navigate('Members', { groupSlug: group.slug })}
className='flex-row items-center'
>
<View className='w-4 h-4 mr-1 align-bottom' >
<Users color='white' size={16} />
</View>
<Text className='text-xs align-middle text-white underline'>
{t('{{count}} Members', { count: group.memberCount })}
</Text>
</TouchableOpacity>
</View>

<TouchableOpacity
onPress={() => navigation.navigate('About', { groupSlug: group.slug })}
hitSlop={6}
>
<View className='cursor-pointer'>
<ChevronRight color='white' size={24} strokeWidth={3}/>
</View>
</TouchableOpacity>
</View>
</View>
)
}
3 changes: 3 additions & 0 deletions apps/mobile/src/components/GroupMenuHeader/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import component from './GroupMenuHeader'

export default component
2 changes: 1 addition & 1 deletion apps/mobile/src/components/Icon/config.json

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
VOTING_METHOD_SINGLE
} from 'urql-shared/presenters/PostPresenter'
import { addProposalVote, removeProposalVote, swapProposalVote } from 'store/actions/proposals'
import QuorumBar from 'components/QuorumBar/QuorumBar'
import QuorumBar from 'components/QuorumBar'
import Icon from 'components/Icon'
import Avatar from 'components/Avatar'
import { useTranslation } from 'react-i18next'
Expand Down
Loading