mirror of
https://github.com/Memo-2023/mana-monorepo.git
synced 2026-05-17 04:39:41 +02:00
- Add uload project with apps/web structure
- Reorganize from flat to monorepo structure
- Remove PocketBase binary and local data
- Update to pnpm and @uload/web namespace
- Add picture project to monorepo
- Remove embedded git repository
- Unify all package names to @{project}/{app} schema:
- @maerchenzauber/* (was @storyteller/*)
- @manacore/* (was manacore-*, manacore)
- @manadeck/* (was web, backend, manadeck)
- @memoro/* (was memoro-web, landing, memoro)
- @picture/* (already unified)
- @uload/web
- Add convenient dev scripts for all apps:
- pnpm dev:{project}:web
- pnpm dev:{project}:landing
- pnpm dev:{project}:mobile
- pnpm dev:{project}:backend
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
56 lines
No EOL
2 KiB
TypeScript
56 lines
No EOL
2 KiB
TypeScript
import AsyncStorage from '@react-native-async-storage/async-storage';
|
|
import { createClient } from '@supabase/supabase-js';
|
|
import { Platform } from 'react-native';
|
|
import type { Database } from '@picture/shared/types';
|
|
|
|
const supabaseUrl = process.env.EXPO_PUBLIC_SUPABASE_URL || 'https://mjuvnnjxwfwlmxjsgkqu.supabase.co';
|
|
const supabaseAnonKey = process.env.EXPO_PUBLIC_SUPABASE_ANON_KEY || 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6Im1qdXZubmp4d2Z3bG14anNna3F1Iiwicm9sZSI6ImFub24iLCJpYXQiOjE3NTYyNTg5NTUsImV4cCI6MjA3MTgzNDk1NX0.EeOKzyPnZ42zpFl7oi54qDcAZSW-XGoB0tSNwUiX9GU';
|
|
|
|
// Create a storage adapter that works for both web and mobile
|
|
const createStorage = () => {
|
|
if (Platform.OS === 'web') {
|
|
// For web, use a simple localStorage wrapper
|
|
return {
|
|
getItem: async (key: string) => {
|
|
try {
|
|
if (typeof window !== 'undefined' && window.localStorage) {
|
|
const item = window.localStorage.getItem(key);
|
|
return item;
|
|
}
|
|
} catch (error) {
|
|
console.error('Error getting item from localStorage:', error);
|
|
}
|
|
return null;
|
|
},
|
|
setItem: async (key: string, value: string) => {
|
|
try {
|
|
if (typeof window !== 'undefined' && window.localStorage) {
|
|
window.localStorage.setItem(key, value);
|
|
}
|
|
} catch (error) {
|
|
console.error('Error setting item in localStorage:', error);
|
|
}
|
|
},
|
|
removeItem: async (key: string) => {
|
|
try {
|
|
if (typeof window !== 'undefined' && window.localStorage) {
|
|
window.localStorage.removeItem(key);
|
|
}
|
|
} catch (error) {
|
|
console.error('Error removing item from localStorage:', error);
|
|
}
|
|
},
|
|
};
|
|
}
|
|
// For mobile, use AsyncStorage
|
|
return AsyncStorage;
|
|
};
|
|
|
|
export const supabase = createClient<Database>(supabaseUrl, supabaseAnonKey, {
|
|
auth: {
|
|
storage: createStorage(),
|
|
autoRefreshToken: true,
|
|
persistSession: true,
|
|
detectSessionInUrl: Platform.OS === 'web',
|
|
},
|
|
}); |