Skip to content

Commit

Permalink
RSN-12 Renamed folder 'packages' to 'shared, implemented base generic…
Browse files Browse the repository at this point in the history
… API services and auth services
  • Loading branch information
wzarek committed Mar 26, 2024
1 parent eb861a0 commit 5f6ff29
Show file tree
Hide file tree
Showing 29 changed files with 496 additions and 126 deletions.
95 changes: 0 additions & 95 deletions Client/reasn-client/README.md

This file was deleted.

25 changes: 3 additions & 22 deletions Client/reasn-client/apps/next/next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,37 +10,18 @@ const boolVals = {
const disableExtraction =
boolVals[process.env.DISABLE_EXTRACTION] ?? process.env.NODE_ENV === 'development'

console.log(`
Welcome to Tamagui!
You can update this monorepo to the latest Tamagui release just by running:
yarn upgrade:tamagui
We've set up a few things for you.
See the "excludeReactNativeWebExports" setting in next.config.js, which omits these
from the bundle: Switch, ProgressBar Picker, CheckBox, Touchable. To save more,
you can add ones you don't need like: AnimatedFlatList, FlatList, SectionList,
VirtualizedList, VirtualizedSectionList.
🐣
Remove this log in next.config.js.
`)
console.log(`APP STARTED`)

const plugins = [
withTamagui({
config: '../../packages/config/src/tamagui.config.ts',
config: '../../shared/config/src/tamagui.config.ts',
components: ['tamagui', '@my/ui'],
importsWhitelist: ['constants.js', 'colors.js'],
outputCSS: process.env.NODE_ENV === 'production' ? './public/tamagui.css' : null,
logTimings: true,
disableExtraction,
shouldExtract: (path) => {
if (path.includes(join('packages', 'app'))) {
if (path.includes(join('shared', 'app'))) {
return true
}
},
Expand Down
2 changes: 1 addition & 1 deletion Client/reasn-client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"private": true,
"workspaces": [
"./apps/*",
"./packages/*"
"./shared/*"
],
"scripts": {
"native": "cd apps/expo && yarn start",
Expand Down
3 changes: 3 additions & 0 deletions Client/reasn-client/shared/app/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
node_modules/
.DS_Store
THUMBS_DB
27 changes: 27 additions & 0 deletions Client/reasn-client/shared/app/features/home/screen.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import {
Button,
H1,
Paragraph,
Separator,
YStack,
} from '@my/ui'
import { useLink } from 'solito/link'

export const HomeScreen = () => {
const link = useLink({
href: '/user/420',
})

return (
<YStack f={1} jc="center" ai="center" p="$4" gap>
<YStack gap="$4" bc="$background">
<H1 ta="center">Reasn.</H1>
<Separator />
<Paragraph>find your reasn to meet</Paragraph>
<Button {...link}>
user
</Button>
</YStack>
</YStack>
)
}
26 changes: 26 additions & 0 deletions Client/reasn-client/shared/app/features/user/detail-screen.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { Button, H1, Paragraph, Separator, YStack } from '@my/ui'
import { ChevronLeft } from '@tamagui/lucide-icons'
import { createParam } from 'solito'
import { useLink } from 'solito/link'

const { useParam } = createParam<{ id: string }>()

export const UserDetailScreen = () => {
const [id] = useParam('id')
const link = useLink({
href: '/',
})

return (
<YStack f={1} jc="center" ai="center" p="$4" gap>
<YStack gap="$4" bc="$background">
<H1 ta="center">Reasn.</H1>
<Separator />
<Paragraph ta="center">{`User ID: ${id}`}</Paragraph>
<Button {...link} icon={ChevronLeft}>
back
</Button>
</YStack>
</YStack>
)
}
4 changes: 4 additions & 0 deletions Client/reasn-client/shared/app/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// leave this blank
// don't re-export files from this workspace. it'll break next.js tree shaking
// https://github.com/vercel/next.js/issues/12557
export {}
27 changes: 27 additions & 0 deletions Client/reasn-client/shared/app/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"version": "0.0.0",
"name": "app",
"main": "index.ts",
"private": true,
"sideEffects": [
"*.css"
],
"dependencies": {
"@my/ui": "0.0.1",
"@tamagui/animations-react-native": "^1.91.4",
"@tamagui/colors": "^1.91.4",
"@tamagui/font-inter": "^1.91.4",
"@tamagui/lucide-icons": "^1.91.4",
"@tamagui/shorthands": "^1.91.4",
"@tamagui/themes": "^1.91.4",
"burnt": "^0.12.1",
"expo-constants": "~14.4.2",
"expo-linking": "~5.0.2",
"react-native-safe-area-context": "4.6.3",
"solito": "^3.0.0"
},
"devDependencies": {
"@types/react": "^18.0.27",
"@types/react-native": "^0.71.3"
}
}
7 changes: 7 additions & 0 deletions Client/reasn-client/shared/app/provider/ToastViewport.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { ToastViewport as ToastViewportOg } from '@my/ui'
import { useSafeAreaInsets } from 'react-native-safe-area-context'

export const ToastViewport = () => {
const { top, right, left } = useSafeAreaInsets()
return <ToastViewportOg top={top + 5} left={left} right={right} />
}
5 changes: 5 additions & 0 deletions Client/reasn-client/shared/app/provider/ToastViewport.web.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { ToastViewport as ToastViewportOg } from '@my/ui'

export const ToastViewport = () => {
return <ToastViewportOg left={0} right={0} top={10} />
}
32 changes: 32 additions & 0 deletions Client/reasn-client/shared/app/provider/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import { CustomToast, TamaguiProvider, TamaguiProviderProps, ToastProvider, config } from '@my/ui'
import { useColorScheme } from 'react-native'

import { ToastViewport } from './ToastViewport'

export function Provider({ children, ...rest }: Omit<TamaguiProviderProps, 'config'>) {
const scheme = useColorScheme()
return (
<TamaguiProvider
config={config}
disableInjectCSS
defaultTheme={scheme === 'dark' ? 'dark' : 'light'}
{...rest}
>
<ToastProvider
swipeDirection="horizontal"
duration={6000}
native={
[
/* uncomment the next line to do native toasts on mobile. NOTE: it'll require you making a dev build and won't work with Expo Go */
// 'mobile'
]
}
>
{children}

<CustomToast />
<ToastViewport />
</ToastProvider>
</TamaguiProvider>
)
}
9 changes: 9 additions & 0 deletions Client/reasn-client/shared/app/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"extends": "../../tsconfig.base",
"include": ["**/*.ts", "**/*.tsx"],
"compilerOptions": {
"composite": true,
"jsx": "react-jsx"
},
"references": []
}
7 changes: 7 additions & 0 deletions Client/reasn-client/shared/app/types.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { config } from '@my/config'

export type Conf = typeof config

declare module '@my/ui' {
interface TamaguiCustomConfig extends Conf {}
}
29 changes: 29 additions & 0 deletions Client/reasn-client/shared/config/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"name": "@my/config",
"version": "0.0.1",
"sideEffects": [
"*.css"
],
"private": true,
"types": "./src",
"main": "src/index.ts",
"files": [
"types",
"dist"
],
"scripts": {
"build": "tamagui-build --skip-types",
"watch": "tamagui-build --skip-types --watch"
},
"dependencies": {
"@tamagui/animations-react-native": "^1.91.4",
"@tamagui/font-inter": "^1.91.4",
"@tamagui/react-native-media-driver": "^1.91.4",
"@tamagui/shorthands": "^1.91.4",
"@tamagui/themes": "^1.91.4",
"tamagui": "^1.91.4"
},
"devDependencies": {
"@tamagui/build": "^1.91.4"
}
}
1 change: 1 addition & 0 deletions Client/reasn-client/shared/config/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './tamagui.config'
Loading

0 comments on commit 5f6ff29

Please sign in to comment.