feat: major UI/UX overhaul + user management + ticket detail refactor

- 5-tab navigation (Home/Clients/Collect/Tickets/Profile)
- Inline styles throughout (17px min font, SafeAreaView)
- Dashboard fixed to match real API shape
- Ticket detail: 2 tabs (Details + Comments), always-visible comment input
- Installation confirmation: GPS coordinate capture + client location update
- User management screens (Admin only): list, create, detail + role/active toggle
- Tasks folder replaces tickets folder
- Remittance detail: inline styles
- Record payment: prefill from client, live button text
- Icon component with SVG icons
- Color system: primary #0891B2
This commit is contained in:
Nemo
2026-03-24 10:37:57 +08:00
parent baed6dc8d5
commit 4644a3194d
38 changed files with 4967 additions and 2984 deletions

View File

@@ -2,12 +2,15 @@ import { create } from 'zustand';
import * as SecureStore from 'expo-secure-store';
import { api } from '../services/api';
const TOKEN_KEY = 'fiberops_token';
const TENANT_KEY = 'fiberops_tenant';
interface AuthState {
token: string | null;
tenantSlug: string | null;
user: any | null;
isLoading: boolean;
login: (tenantSlug: string, username: string, password: string) => Promise<void>;
login: (tenantSlug: string, email: string, password: string) => Promise<void>;
logout: () => Promise<void>;
hydrate: () => Promise<void>;
}
@@ -20,8 +23,8 @@ export const useAuthStore = create<AuthState>((set) => ({
hydrate: async () => {
try {
const token = await SecureStore.getItemAsync('auth_token');
const tenantSlug = await SecureStore.getItemAsync('tenant_slug');
const token = await SecureStore.getItemAsync(TOKEN_KEY);
const tenantSlug = await SecureStore.getItemAsync(TENANT_KEY);
if (token && tenantSlug) {
const res = await api.get('/api/v1/auth/me');
set({ token, tenantSlug, user: res.data, isLoading: false });
@@ -29,23 +32,23 @@ export const useAuthStore = create<AuthState>((set) => ({
set({ isLoading: false });
}
} catch {
await SecureStore.deleteItemAsync('auth_token');
await SecureStore.deleteItemAsync('tenant_slug');
await SecureStore.deleteItemAsync(TOKEN_KEY);
await SecureStore.deleteItemAsync(TENANT_KEY);
set({ token: null, tenantSlug: null, user: null, isLoading: false });
}
},
login: async (tenantSlug, username, password) => {
const res = await api.post('/api/v1/auth/login', { tenantSlug, username, password });
const { token, user } = res.data;
await SecureStore.setItemAsync('auth_token', token);
await SecureStore.setItemAsync('tenant_slug', tenantSlug);
set({ token, tenantSlug, user });
login: async (tenantSlug, email, password) => {
const res = await api.post('/api/v1/auth/login', { tenantSlug, email, password });
const { accessToken, user } = res.data;
await SecureStore.setItemAsync(TOKEN_KEY, accessToken);
await SecureStore.setItemAsync(TENANT_KEY, tenantSlug);
set({ token: accessToken, tenantSlug, user });
},
logout: async () => {
await SecureStore.deleteItemAsync('auth_token');
await SecureStore.deleteItemAsync('tenant_slug');
await SecureStore.deleteItemAsync(TOKEN_KEY);
await SecureStore.deleteItemAsync(TENANT_KEY);
set({ token: null, tenantSlug: null, user: null });
},
}));