diff --git a/apps/desktop/package.json b/apps/desktop/package.json index ba29918..fafef6b 100644 --- a/apps/desktop/package.json +++ b/apps/desktop/package.json @@ -11,27 +11,17 @@ "build": "tauri build" }, "dependencies": { - "@tanstack/react-query": "^4.22.0", "@tauri-apps/api": "^1.2.0", - "@trpc/client": "^10.9.0", - "@trpc/react-query": "^10.9.0", - "@trpc/server": "^10.9.0", - "react": "^18.1.0", - "react-dom": "^18.1.0", "react-router-dom": "^6.7.0", "server": "*", - "store": "*", - "superjson": "^1.12.2" + "store": "*" }, "devDependencies": { "@tauri-apps/cli": "^1.2.3", - "@types/react": "^18.0.27", - "@types/react-dom": "^18.0.10", "@vitejs/plugin-react-swc": "^3.0.1", "autoprefixer": "^10.4.13", "postcss": "^8.4.21", "tailwindcss": "^3.2.4", - "typescript": "^4.9.4", "vite": "^4.0.4" } } diff --git a/apps/desktop/src/components/Home.tsx b/apps/desktop/src/components/Home.tsx index 06ba242..a0a2eaa 100644 --- a/apps/desktop/src/components/Home.tsx +++ b/apps/desktop/src/components/Home.tsx @@ -8,7 +8,7 @@ import Button from "./Button"; const Home = () => { const [greetMsg, setGreetMsg] = useState(""); const [name, setName] = useState(""); - const hello = api.task.hello.useQuery({ text: "client" }); + const hello = api.example.hello.useQuery({ text: "client" }); const [count, setCount] = useAtom(countAtom); async function greet() { diff --git a/apps/mobile/App.tsx b/apps/mobile/App.tsx index 35be518..1ebd639 100644 --- a/apps/mobile/App.tsx +++ b/apps/mobile/App.tsx @@ -1,16 +1,20 @@ import Constants from "expo-constants"; import { useState } from "react"; -import { api } from "$api"; -import useCachedResources from "$hooks/useCachedResources"; +import { api } from "$trpc"; +import { NavigationContainer } from "@react-navigation/native"; import { QueryClient, QueryClientProvider } from "@tanstack/react-query"; import { httpBatchLink } from "@trpc/client"; import { StatusBar } from "expo-status-bar"; -import { KeyboardAvoidingView, Platform } from "react-native"; -import { SafeAreaProvider } from "react-native-safe-area-context"; -import Toast from "react-native-toast-message"; import superjson from "superjson"; -import Navigation from "./navigation"; +import { NavigatorParamList } from "types"; +import StackNavigator from "./navigation/StackNavigator"; + +declare global { + namespace ReactNavigation { + interface RootParamList extends NavigatorParamList {} + } +} const { manifest } = Constants; const localhost = `http://${manifest!.debuggerHost?.split(":").shift()}:3000`; @@ -28,25 +32,13 @@ const App = () => { }), ); - const isCachedResourceLoaded = useCachedResources(); - - if (!isCachedResourceLoaded) { - return null; - } - return ( - - - - - - - + + + + ); diff --git a/apps/mobile/app.json b/apps/mobile/app.json index 21af9b0..a5a07ac 100644 --- a/apps/mobile/app.json +++ b/apps/mobile/app.json @@ -1,41 +1,31 @@ { "expo": { - "name": "productiv", - "slug": "productiv", - "version": "0.1.0", + "name": "zeno", + "slug": "zeno", + "version": "2.5.0", "orientation": "portrait", - "icon": "./assets/images/icon.png", - "userInterfaceStyle": "automatic", - "scheme": "productiv", + "icon": "./assets/icon.png", + "userInterfaceStyle": "light", "splash": { - "image": "./assets/images/splash.png", + "image": "./assets/splash.png", "resizeMode": "contain", "backgroundColor": "#ffffff" }, "updates": { "fallbackToCacheTimeout": 0 }, - "assetBundlePatterns": [ - "**/*" - ], + "assetBundlePatterns": ["**/*"], "ios": { - "supportsTablet": true, - "bundleIdentifier": "com.zeno.productiv" + "supportsTablet": true }, "android": { - "package": "com.zeno.productiv", "adaptiveIcon": { - "foregroundImage": "./assets/images/adaptive-icon.png", + "foregroundImage": "./assets/adaptive-icon.png", "backgroundColor": "#FFFFFF" } }, "web": { - "favicon": "./assets/images/favicon.png" - }, - "extra": { - "eas": { - "projectId": "ae71fe4a-0f1f-4f72-b061-a641f6ea5e21" - } + "favicon": "./assets/favicon.png" } } } diff --git a/apps/mobile/assets/adaptive-icon.png b/apps/mobile/assets/adaptive-icon.png new file mode 100644 index 0000000..03d6f6b Binary files /dev/null and b/apps/mobile/assets/adaptive-icon.png differ diff --git a/apps/mobile/assets/favicon.png b/apps/mobile/assets/favicon.png new file mode 100644 index 0000000..e75f697 Binary files /dev/null and b/apps/mobile/assets/favicon.png differ diff --git a/apps/mobile/assets/icon.png b/apps/mobile/assets/icon.png new file mode 100644 index 0000000..a0b1526 Binary files /dev/null and b/apps/mobile/assets/icon.png differ diff --git a/apps/mobile/assets/splash.png b/apps/mobile/assets/splash.png new file mode 100644 index 0000000..0e89705 Binary files /dev/null and b/apps/mobile/assets/splash.png differ diff --git a/apps/mobile/babel.config.js b/apps/mobile/babel.config.js index 14d31eb..6ef673b 100644 --- a/apps/mobile/babel.config.js +++ b/apps/mobile/babel.config.js @@ -4,35 +4,13 @@ module.exports = function (api) { presets: ["babel-preset-expo"], plugins: [ "nativewind/babel", - "react-native-reanimated/plugin", - [ - "module:react-native-dotenv", - { - moduleName: "$env", - path: ".env", - blocklist: null, - allowlist: null, - safe: false, - allowUndefined: true, - }, - ], [ "module-resolver", { alias: { $server: "server", $store: "store", - $utils: "utils", - $variables: "variables", - $types: "types", - $constants: "./constants", - $api: "./utils/api.ts", - $assets: "./assets", - $components: "./components", - $hooks: "./hooks", - $navigation: "./navigation", - $screens: "./screens", - $themes: "./themes", + $trpc: "./utils/trpc.ts", }, }, ], diff --git a/apps/mobile/components/Button.tsx b/apps/mobile/components/Button.tsx new file mode 100644 index 0000000..592ae8d --- /dev/null +++ b/apps/mobile/components/Button.tsx @@ -0,0 +1,37 @@ +import React from "react"; +import { Pressable, PressableProps, StyleSheet, Text } from "react-native"; +import colors from "../../../colors"; + +type ButtonProps = { + title: string; + onPress: () => void; + children?: React.ReactNode; +}; + +const Button = (props: ButtonProps & PressableProps) => { + const { title, onPress, children, ...rest } = props; + return ( + [styles.button, pressed && styles.pressed]} + > + {children || {title}} + + ); +}; + +export default Button; + +const styles = StyleSheet.create({ + button: { + backgroundColor: colors.lemon[400], + borderRadius: 6, + paddingHorizontal: 12, + paddingVertical: 8, + margin: 16, + }, + pressed: { + backgroundColor: colors.lemon[200], + }, +}); diff --git a/apps/mobile/components/Loader.tsx b/apps/mobile/components/Loader.tsx new file mode 100644 index 0000000..457c251 --- /dev/null +++ b/apps/mobile/components/Loader.tsx @@ -0,0 +1,11 @@ +import { Text, View } from "react-native"; + +const Loader = () => { + return ( + + Loading... + + ); +}; + +export default Loader; diff --git a/apps/mobile/components/Screen.tsx b/apps/mobile/components/Screen.tsx new file mode 100644 index 0000000..f0cebf3 --- /dev/null +++ b/apps/mobile/components/Screen.tsx @@ -0,0 +1,38 @@ +import { LinearGradient } from "expo-linear-gradient"; +import { + KeyboardAvoidingView, + Platform, + SafeAreaView, + ViewProps, +} from "react-native"; +import colors from "tailwindcss/colors"; + +type ScreenProps = { + children: React.ReactNode; +}; + +const Screen: React.FC = ({ + children, + style, + ...props +}) => { + return ( + + + + {children} + + + + ); +}; + +export default Screen; diff --git a/apps/mobile/components/Text.tsx b/apps/mobile/components/Text.tsx index 776d772..0215f07 100644 --- a/apps/mobile/components/Text.tsx +++ b/apps/mobile/components/Text.tsx @@ -1,36 +1,16 @@ -import { FontWeight } from "$types"; -import { FONT_FAMILY, PALETTE } from "$variables"; -import { styled } from "nativewind"; -import { - Text as NativeText, - TextProps as NativeTextProps, - TextStyle, -} from "react-native"; - -type TextProps = { - children: React.ReactNode; - style?: TextStyle | TextStyle[]; - variant?: FontWeight; -}; - -const TextComponent: React.FC = (props) => { - const { children, style, variant = "regular", ...rest } = props; - - return ( - - {children} - - ); -}; - -export const Text = styled(TextComponent); +import { Text as RNText, TextProps as RNTextProps } from "react-native"; + +type TextProps = { + children: React.ReactNode; +}; + +const Text = (props: TextProps & RNTextProps) => { + const { children, ...rest } = props; + return ( + + {children} + + ); +}; + +export default Text; diff --git a/apps/mobile/index.ts b/apps/mobile/index.ts index 64ebbbc..828b356 100644 --- a/apps/mobile/index.ts +++ b/apps/mobile/index.ts @@ -1,4 +1,3 @@ -import "react-native-gesture-handler"; import { registerRootComponent } from "expo"; import App from "./App"; diff --git a/apps/mobile/navigation/StackNavigator.tsx b/apps/mobile/navigation/StackNavigator.tsx index 0453602..dd4923c 100644 --- a/apps/mobile/navigation/StackNavigator.tsx +++ b/apps/mobile/navigation/StackNavigator.tsx @@ -1,49 +1,23 @@ -import { - AddTaskScreen, - ModalScreen, - NotFoundScreen, - OnboardingScreen, -} from "$screens"; -import { RootNativeStackParamList } from "$types"; import { createNativeStackNavigator } from "@react-navigation/native-stack"; -import DrawerNavigator from "./DrawerNavigator"; +import { NavigatorParamList } from "types"; +import Home from "../screens/Home"; +import Welcome from "../screens/Welcome"; -const Stack = createNativeStackNavigator(); +const Stack = createNativeStackNavigator(); -function StackNavigator() { +const StackNavigator = () => { return ( - - - - - - - + + ); -} +}; export default StackNavigator; diff --git a/apps/mobile/package.json b/apps/mobile/package.json index 31679d3..c2be0fc 100644 --- a/apps/mobile/package.json +++ b/apps/mobile/package.json @@ -11,52 +11,24 @@ }, "dependencies": { "@react-native-async-storage/async-storage": "~1.17.3", - "@react-native-community/datetimepicker": "6.5.2", - "@react-navigation/drawer": "^6.5.8", "@react-navigation/native": "^6.1.2", "@react-navigation/native-stack": "^6.9.8", - "@tanstack/react-query": "^4.22.0", - "@trpc/client": "^10.9.0", - "@trpc/server": "^10.9.0", - "classnames": "^2.3.2", "expo": "^47.0.13", - "expo-auth-session": "~3.8.0", "expo-constants": "~14.0.2", - "expo-dev-client": "~2.0.1", - "expo-font": "~11.0.1", "expo-linear-gradient": "~12.0.1", - "expo-linking": "~3.3.0", - "expo-random": "~13.0.0", - "expo-splash-screen": "~0.17.5", "expo-status-bar": "~1.4.2", - "expo-web-browser": "~12.0.0", - "jotai": "^1.13.1", "nativewind": "^2.0.11", - "react": "18.1.0", - "react-dom": "18.1.0", "react-native": "0.70.5", - "react-native-gesture-handler": "~2.8.0", - "react-native-modal-datetime-picker": "^14.0.1", - "react-native-reanimated": "~2.12.0", "react-native-safe-area-context": "4.4.1", "react-native-screens": "~3.18.0", - "react-native-svg": "13.4.0", - "react-native-toast-message": "^2.1.5", "react-native-web": "~0.18.9", "server": "*", - "store": "*", - "superjson": "^1.12.2", - "types": "*", - "utils": "*", - "variables": "*" + "store": "*" }, "devDependencies": { "@babel/core": "^7.20.12", - "@types/react": "~18.0.24", "@types/react-native": "~0.70.6", - "react-native-dotenv": "^3.4.7", "react-native-svg-transformer": "^1.0.0", - "tailwindcss": "^3.2.4", - "typescript": "^4.9.4" + "tailwindcss": "^3.2.4" } } diff --git a/apps/mobile/screens/Home.tsx b/apps/mobile/screens/Home.tsx new file mode 100644 index 0000000..9c0199a --- /dev/null +++ b/apps/mobile/screens/Home.tsx @@ -0,0 +1,47 @@ +import { View } from "react-native"; + +import { countAtom } from "$store"; +import { api } from "$trpc"; +import { useNavigation } from "@react-navigation/native"; +import { useAtom } from "jotai"; +import Button from "../components/Button"; +import Loader from "../components/Loader"; +import Screen from "../components/Screen"; +import Text from "../components/Text"; + +const Home = () => { + const hello = api.example.hello.useQuery({ text: "client" }); + const [count, setCount] = useAtom(countAtom); + + const navigation = useNavigation(); + + const navigateToWelcome = () => navigation.navigate("Welcome"); + + if (!hello.data) return ; + + return ( + + + + Greetings from Zeno 👋 + + + + This comes from trpc server: + {hello.data.greeting} + + + This comes from jotai state: + {count} +