From 649636f824cb2bb5b6fc4e153d51f0dbd834548e Mon Sep 17 00:00:00 2001 From: StarAppeal Date: Fri, 22 Nov 2024 14:12:18 +0100 Subject: [PATCH] prototype thingy --- .gitignore | 42 + README.md | 51 +- app.json | 50 + app/(tabs)/_layout.tsx | 42 + app/(tabs)/about.tsx | 21 + app/(tabs)/index.tsx | 62 + app/+not-found.tsx | 30 + app/_layout.tsx | 10 + assets/fonts/SpaceMono-Regular.ttf | Bin 0 -> 93252 bytes assets/images/GarfieldCharakter.webp | Bin 0 -> 25718 bytes assets/images/adaptive-icon.png | Bin 0 -> 17547 bytes assets/images/favicon.png | Bin 0 -> 1466 bytes assets/images/icon.png | Bin 0 -> 22380 bytes assets/images/partial-react-logo.png | Bin 0 -> 5075 bytes assets/images/react-logo.png | Bin 0 -> 6341 bytes assets/images/react-logo@2x.png | Bin 0 -> 14225 bytes assets/images/react-logo@3x.png | Bin 0 -> 21252 bytes assets/images/splash-icon.png | Bin 0 -> 17547 bytes components/Button.tsx | 61 + components/ImageViewer.tsx | 18 + eas.json | 27 + hooks/useService.ts | 36 + model/User.ts | 16 + package-lock.json | 15606 +++++++++++++++++++++++++ package.json | 60 + services/RestService.ts | 72 + tsconfig.json | 17 + 27 files changed, 16220 insertions(+), 1 deletion(-) create mode 100644 .gitignore create mode 100644 app.json create mode 100644 app/(tabs)/_layout.tsx create mode 100644 app/(tabs)/about.tsx create mode 100644 app/(tabs)/index.tsx create mode 100644 app/+not-found.tsx create mode 100644 app/_layout.tsx create mode 100755 assets/fonts/SpaceMono-Regular.ttf create mode 100644 assets/images/GarfieldCharakter.webp create mode 100644 assets/images/adaptive-icon.png create mode 100644 assets/images/favicon.png create mode 100644 assets/images/icon.png create mode 100644 assets/images/partial-react-logo.png create mode 100644 assets/images/react-logo.png create mode 100644 assets/images/react-logo@2x.png create mode 100644 assets/images/react-logo@3x.png create mode 100644 assets/images/splash-icon.png create mode 100644 components/Button.tsx create mode 100644 components/ImageViewer.tsx create mode 100644 eas.json create mode 100644 hooks/useService.ts create mode 100644 model/User.ts create mode 100644 package-lock.json create mode 100644 package.json create mode 100644 services/RestService.ts create mode 100644 tsconfig.json diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e1fb2ba --- /dev/null +++ b/.gitignore @@ -0,0 +1,42 @@ +# Learn more https://docs.github.com/en/get-started/getting-started-with-git/ignoring-files + +# dependencies +node_modules/ + +# Expo +.expo/ +dist/ +web-build/ +expo-env.d.ts + +# Native +*.orig.* +*.jks +*.p8 +*.p12 +*.key +*.mobileprovision + +# Metro +.metro-health-check* + +# debug +npm-debug.* +yarn-debug.* +yarn-error.* + +# macOS +.DS_Store +*.pem + +# local env files +.env*.local + +# typescript +*.tsbuildinfo + +app-example + +.env + +.idea diff --git a/README.md b/README.md index 7cfd8d3..cd4feb8 100644 --- a/README.md +++ b/README.md @@ -1 +1,50 @@ -# matrix-frontend \ No newline at end of file +# Welcome to your Expo app 👋 + +This is an [Expo](https://expo.dev) project created with [`create-expo-app`](https://www.npmjs.com/package/create-expo-app). + +## Get started + +1. Install dependencies + + ```bash + npm install + ``` + +2. Start the app + + ```bash + npx expo start + ``` + +In the output, you'll find options to open the app in a + +- [development build](https://docs.expo.dev/develop/development-builds/introduction/) +- [Android emulator](https://docs.expo.dev/workflow/android-studio-emulator/) +- [iOS simulator](https://docs.expo.dev/workflow/ios-simulator/) +- [Expo Go](https://expo.dev/go), a limited sandbox for trying out app development with Expo + +You can start developing by editing the files inside the **app** directory. This project uses [file-based routing](https://docs.expo.dev/router/introduction). + +## Get a fresh project + +When you're ready, run: + +```bash +npm run reset-project +``` + +This command will move the starter code to the **app-example** directory and create a blank **app** directory where you can start developing. + +## Learn more + +To learn more about developing your project with Expo, look at the following resources: + +- [Expo documentation](https://docs.expo.dev/): Learn fundamentals, or go into advanced topics with our [guides](https://docs.expo.dev/guides). +- [Learn Expo tutorial](https://docs.expo.dev/tutorial/introduction/): Follow a step-by-step tutorial where you'll create a project that runs on Android, iOS, and the web. + +## Join the community + +Join our community of developers creating universal apps. + +- [Expo on GitHub](https://github.com/expo/expo): View our open source platform and contribute. +- [Discord community](https://chat.expo.dev): Chat with Expo users and ask questions. diff --git a/app.json b/app.json new file mode 100644 index 0000000..0aa210f --- /dev/null +++ b/app.json @@ -0,0 +1,50 @@ +{ + "expo": { + "name": "matrix-frontend", + "slug": "matrix-frontend", + "version": "1.0.0", + "orientation": "portrait", + "icon": "./assets/images/icon.png", + "scheme": "myapp", + "userInterfaceStyle": "automatic", + "newArchEnabled": true, + "ios": { + "supportsTablet": true + }, + "android": { + "adaptiveIcon": { + "foregroundImage": "./assets/images/adaptive-icon.png", + "backgroundColor": "#ffffff" + }, + "package": "de.starappeal.ledmatrix" + }, + "web": { + "bundler": "metro", + "output": "static", + "favicon": "./assets/images/favicon.png" + }, + "plugins": [ + "expo-router", + [ + "expo-splash-screen", + { + "image": "./assets/images/splash-icon.png", + "imageWidth": 200, + "resizeMode": "contain", + "backgroundColor": "#ffffff" + } + ] + ], + "experiments": { + "typedRoutes": true + }, + "extra": { + "router": { + "origin": false + }, + "eas": { + "projectId": "6c7ada5a-fcc7-4d36-a056-c542c6d13dac" + } + } + } +} diff --git a/app/(tabs)/_layout.tsx b/app/(tabs)/_layout.tsx new file mode 100644 index 0000000..88ce1ff --- /dev/null +++ b/app/(tabs)/_layout.tsx @@ -0,0 +1,42 @@ +import {Tabs} from 'expo-router'; + +import Ionicons from '@expo/vector-icons/Ionicons'; + + +export default function TabLayout() { + return ( + + ( + + ), + }} + /> + ( + + ), + }} + /> + + ); +} diff --git a/app/(tabs)/about.tsx b/app/(tabs)/about.tsx new file mode 100644 index 0000000..105598f --- /dev/null +++ b/app/(tabs)/about.tsx @@ -0,0 +1,21 @@ +import { Text, View, StyleSheet } from 'react-native'; + +export default function AboutScreen() { + return ( + + About screen + + ); +} + +const styles = StyleSheet.create({ + container: { + flex: 1, + backgroundColor: '#25292e', + justifyContent: 'center', + alignItems: 'center', + }, + text: { + color: '#fff', + }, +}); diff --git a/app/(tabs)/index.tsx b/app/(tabs)/index.tsx new file mode 100644 index 0000000..bf2965e --- /dev/null +++ b/app/(tabs)/index.tsx @@ -0,0 +1,62 @@ +import {ActivityIndicator, StyleSheet, Text, View} from 'react-native'; +import Button from '@/components/Button'; +import ImageViewer from '@/components/ImageViewer'; + +const PlaceholderImage = require('@/assets/images/GarfieldCharakter.webp'); + +import * as ImagePicker from 'expo-image-picker'; +import {RestService} from '@/services/RestService'; +import useService from '@/hooks/useService'; + +export default function Index() { + const {data, loading, error} = useService(RestService.fetchAllUser); + + const pickImageAsync = async () => { + let result = await ImagePicker.launchImageLibraryAsync({ + mediaTypes: ['images'], + allowsEditing: true, + quality: 1, + }); + + if (!result.canceled) { + console.log(result); + } else { + alert('You did not select any image.'); + } + }; + + console.log(data); + return ( + + + + + + {loading && } + {error && Error: {error.message}} + {data && ( + + {data.users.map((item) => item.name).join('; ')} + + )} +