up to seed

This commit is contained in:
dimitar 2025-01-18 21:16:06 +01:00
parent fe95ee5887
commit 91e5838b00
4 changed files with 37 additions and 4 deletions

View File

@ -12,7 +12,7 @@ export default function Index() {
const {user, refetch} = useGlobalContext(); const {user, refetch} = useGlobalContext();
return ( return (
<SafeAreaView className={'bg-white h-full'}> <SafeAreaView className={'bg-white h-full'}>
<FlatList data={[1,2,3,4]} <FlatList data={[5,6,7,8]}
renderItem={({item}) => ( renderItem={({item}) => (
<Card/> <Card/>
)} )}

View File

@ -16,7 +16,7 @@ export const FeaturedCard = ({onPress} :Props) => {
<View className={'flex flex-row items-center bg-white/90 px-3 py-1.5 rounded-full absolute top-5 right-1'}> <View className={'flex flex-row items-center bg-white/90 px-3 py-1.5 rounded-full absolute top-5 right-1'}>
<Image source={icons.star} className={'size-3'}/> <Image source={icons.star} className={'size-3'}/>
<Text className={'text-sm ml-1'}>5.0</Text> <Text className={'text-sm ml-1'}>5</Text>
</View> </View>
<View className={'flex flex-col items-start absolute bottom-1 inset-x-5'}> <View className={'flex flex-col items-start absolute bottom-1 inset-x-5'}>
<Text className={'text-white text-base font-bold'} numberOfLines={1}>Honda - xyz</Text> <Text className={'text-white text-base font-bold'} numberOfLines={1}>Honda - xyz</Text>

View File

@ -1,11 +1,18 @@
import {Account, Avatars, Client, OAuthProvider} from "react-native-appwrite"; import {Account, Avatars, Client, Databases, OAuthProvider, Query} from "react-native-appwrite";
import * as Linking from "expo-linking" import * as Linking from "expo-linking"
import {openAuthSessionAsync} from "expo-web-browser"; import {openAuthSessionAsync} from "expo-web-browser";
import {attribute} from "postcss-selector-parser";
import limit from "ajv-formats/src/limit";
export const config = { export const config = {
platform: 'com.placebomk.mobilemk', platform: 'com.placebomk.mobilemk',
endpoint: process.env.EXPO_PUBLIC_APPWRITE_ENDPOINT, endpoint: process.env.EXPO_PUBLIC_APPWRITE_ENDPOINT,
projectId: process.env.EXPO_PUBLIC_APPWRITE_PROJECT_ID, projectId: process.env.EXPO_PUBLIC_APPWRITE_PROJECT_ID,
databaseId: process.env.EXPO_PUBLIC_APPWRITE_DATABASE_ID,
oglasuvacId: process.env.EXPO_PUBLIC_APPWRITE_OGLASUVAC_COLLECTION_ID,
galleryId: process.env.EXPO_PUBLIC_APPWRITE_GALERIES_COLLECTION_ID,
reviewId: process.env.EXPO_PUBLIC_APPWRITE_REVIEWS_COLLECTION_ID,
vehicleId: process.env.EXPO_PUBLIC_APPWRITE_VEHICLE_COLLECTION_ID,
} }
export const client = new Client(); export const client = new Client();
@ -17,7 +24,7 @@ client
export const avatar = new Avatars(client); export const avatar = new Avatars(client);
export const account = new Account(client); export const account = new Account(client);
export const databases = new Databases(client);
export async function login (){ export async function login (){
// Your code here to authenticate the user and return their JWT token. // Your code here to authenticate the user and return their JWT token.
@ -80,3 +87,28 @@ export async function logOut(): Promise<boolean> {
return false; return false;
} }
} }
export async function getData() {
try {
const result =await databases.listDocuments(
config.databaseId!,
config.vehicleId!,
[Query.orderAsc(`$createdAt`), Query.limit(5)],
)
console.log(result.documents)
return result.documents;
}
catch (error) {
console.error("Failed to fetch data:", error);
return [];
}
}
export async function getVehicles({filter, query, limit}: {
filter?: string;
query?: string;
limit?: number;
}){
}

View File

@ -1 +1,2 @@
splash screen not showing splash screen not showing
database seed 2:32