Update app.json, index.tsx, profile.tsx, schedule.tsx, and package.json for enhancements and cleanup

This commit is contained in:
2025-07-28 01:43:45 +02:00
parent fa5dd09d04
commit f98ffef4ce
6 changed files with 270 additions and 375 deletions

View File

@@ -17,7 +17,8 @@
"foregroundImage": "./assets/images/icon.png", "foregroundImage": "./assets/images/icon.png",
"backgroundColor": "#0c0a0a" "backgroundColor": "#0c0a0a"
}, },
"edgeToEdgeEnabled": true "edgeToEdgeEnabled": true,
"package": "com.devbeni.mcbeno"
}, },
"web": { "web": {
"bundler": "metro", "bundler": "metro",

View File

@@ -20,7 +20,7 @@ export default function Index() {
(async () => { (async () => {
const savedEmail = await SecureStore.getItemAsync('email'); const savedEmail = await SecureStore.getItemAsync('email');
const savedPassword = await SecureStore.getItemAsync('password'); const savedPassword = await SecureStore.getItemAsync('password');
console.log('Mentett email:', savedEmail, 'Mentett password:', savedPassword); // ...
if (savedEmail && savedPassword) { if (savedEmail && savedPassword) {
setUsername(savedEmail); setUsername(savedEmail);
setPassword(savedPassword); setPassword(savedPassword);
@@ -36,7 +36,7 @@ export default function Index() {
setLoading(true); setLoading(true);
const user = emailOverride ?? username; const user = emailOverride ?? username;
const pass = passwordOverride ?? password; const pass = passwordOverride ?? password;
console.log('Login attempt:', user); // ...
try { try {
const response = await axios.post( const response = await axios.post(
"https://mymenu.mcdonalds.hu/api/AccountApi/Login", "https://mymenu.mcdonalds.hu/api/AccountApi/Login",
@@ -55,8 +55,9 @@ export default function Index() {
} }
} }
); );
//console.log('Login response:', response.data, response.headers);
const cookie = response.headers['set-cookie']?.join('; '); const cookie = response.headers['set-cookie']?.join('; ') || '';
const userId = response.data.Data.UserID; const userId = response.data.Data.UserID;
const fullName = response.data.Data.FullName; const fullName = response.data.Data.FullName;
await SecureStore.setItemAsync('cookie', cookie || ''); await SecureStore.setItemAsync('cookie', cookie || '');
@@ -64,18 +65,16 @@ export default function Index() {
await SecureStore.setItemAsync('email', user); await SecureStore.setItemAsync('email', user);
await SecureStore.setItemAsync('password', pass); await SecureStore.setItemAsync('password', pass);
await SecureStore.setItemAsync('fullName', fullName || ''); await SecureStore.setItemAsync('fullName', fullName || '');
//console.log('Saved to SecureStore:', { cookie, userId, user, pass, fullName });
if (isAuto) { if (isAuto) {
if (Platform.OS === 'android') { if (Platform.OS === 'android') {
ToastAndroid.show('Sikeres automatikus bejelentkezés', ToastAndroid.SHORT); ToastAndroid.show('Sikeres automatikus bejelentkezés', ToastAndroid.SHORT);
} else { } else {
// iOS: custom toast helyett Alert // ...
console.log('Sikeres automatikus bejelentkezés');
} }
} }
router.replace('/profile'); router.replace('/profile');
} catch (e) { } catch (e) {
console.log('Login error:', e); // ...
Alert.alert('Hiba', 'Hibás felhasználónév vagy jelszó, vagy hálózati hiba.'); Alert.alert('Hiba', 'Hibás felhasználónév vagy jelszó, vagy hálózati hiba.');
} finally { } finally {
setLoading(false); setLoading(false);

View File

@@ -1,27 +1,17 @@
import { Ionicons, MaterialCommunityIcons, MaterialIcons } from '@expo/vector-icons'; import { Ionicons, MaterialCommunityIcons, MaterialIcons } from '@expo/vector-icons';
import axios from 'axios';
import { addDays, addMonths, endOfMonth, endOfWeek, format, getMonth, getYear, isSameDay, startOfMonth, startOfWeek, subMonths } from 'date-fns';
import { useRouter } from 'expo-router'; import { useRouter } from 'expo-router';
import * as SecureStore from 'expo-secure-store'; import * as SecureStore from 'expo-secure-store';
import React, { useEffect, useState } from "react"; import React, { useEffect, useState } from "react";
import { ScrollView, StyleSheet, Text, TouchableOpacity, View } from "react-native"; import { StyleSheet, Text, TouchableOpacity, View } from "react-native";
const PRIMARY = '#A24BFA'; const PRIMARY = '#A24BFA';
const BG = '#0c0a0a'; const BG = '#0c0a0a';
const NAV_ITEMS = [
{ key: 'profile', label: 'Profilom', icon: (color: string) => <MaterialIcons name="person" size={28} color={color} /> },
{ key: 'schedule', label: 'Beosztás', icon: (color: string) => <MaterialCommunityIcons name="calendar-month" size={28} color={color} /> },
{ key: 'requests', label: 'Kérelmek', icon: (color: string) => <Ionicons name="mail" size={28} color={color} /> },
];
export default function Profile() { export default function Profile() {
const [fullName, setFullName] = useState(''); const [fullName, setFullName] = useState('');
const [email, setEmail] = useState(''); const [email, setEmail] = useState('');
const [userId, setUserId] = useState(''); const [userId, setUserId] = useState('');
const [activeTab, setActiveTab] = useState('profile');
const [currentMonth, setCurrentMonth] = useState(new Date());
const [workdays, setWorkdays] = useState<any[]>([]);
const [loading, setLoading] = useState(false);
const router = useRouter(); const router = useRouter();
useEffect(() => { useEffect(() => {
@@ -35,38 +25,6 @@ export default function Profile() {
})(); })();
}, []); }, []);
useEffect(() => {
if (activeTab === 'schedule') {
fetchWorkdays();
}
// eslint-disable-next-line
}, [currentMonth, activeTab]);
async function fetchWorkdays() {
setLoading(true);
try {
const userCookie = await SecureStore.getItemAsync('cookie');
const year = getYear(currentMonth);
const month = getMonth(currentMonth) + 1;
const response = await axios.post(
'https://mymenu.mcdonalds.hu/api/UserDataApi/GetWorkDayMonthList',
{ Data: { Year: year, Month: month } },
{
headers: {
'Content-Type': 'application/json',
'cookie': userCookie,
'origin': 'https://mymenu.mcdonalds.hu',
},
}
);
setWorkdays(response.data.data.Data || []);
} catch (e) {
setWorkdays([]);
} finally {
setLoading(false);
}
}
async function handleLogout() { async function handleLogout() {
await SecureStore.deleteItemAsync('cookie'); await SecureStore.deleteItemAsync('cookie');
await SecureStore.deleteItemAsync('userId'); await SecureStore.deleteItemAsync('userId');
@@ -76,122 +34,43 @@ export default function Profile() {
router.replace('/'); router.replace('/');
} }
function renderCalendar() {
const monthStart = startOfMonth(currentMonth);
const monthEnd = endOfMonth(monthStart);
const startDate = startOfWeek(monthStart, { weekStartsOn: 1 });
const endDate = endOfWeek(monthEnd, { weekStartsOn: 1 });
const today = new Date();
const rows = [];
let days = [];
let day = startDate;
let formattedDate = '';
while (day <= endDate) {
for (let i = 0; i < 7; i++) {
formattedDate = format(day, 'yyyy-MM-dd');
const wd = workdays.find(w => w.WorkDay?.slice(0, 10) === formattedDate);
let bg = 'rgba(24,20,28,0.7)';
let color = '#fff';
let borderWidth = 0;
if (isSameDay(day, today)) {
borderWidth = 2;
color = PRIMARY;
}
if (wd) {
bg = wd.color || 'deepskyblue';
color = '#222';
}
days.push(
<View key={day.toString()} style={{ flex: 1, aspectRatio: 1, margin: 2 }}>
<View style={{
backgroundColor: bg,
borderRadius: 8,
borderWidth,
borderColor: PRIMARY,
justifyContent: 'center',
alignItems: 'center',
flex: 1,
}}>
<Text style={{ color, fontWeight: isSameDay(day, today) ? 'bold' : 'normal' }}>{format(day, 'd')}</Text>
{wd && <Text style={{ color, fontSize: 10 }}>{wd.text}</Text>}
</View>
</View>
);
day = addDays(day, 1);
}
rows.push(<View key={day.toString()} style={{ flexDirection: 'row' }}>{days}</View>);
days = [];
}
return (
<View>
<View style={{ flexDirection: 'row', alignItems: 'center', justifyContent: 'space-between', marginBottom: 12 }}>
<TouchableOpacity onPress={() => setCurrentMonth(subMonths(currentMonth, 1))}><Ionicons name="chevron-back" size={28} color="#fff" /></TouchableOpacity>
<Text style={{ color: '#fff', fontSize: 18, fontWeight: 'bold' }}>{format(currentMonth, 'yyyy. MMMM')}</Text>
<TouchableOpacity onPress={() => setCurrentMonth(addMonths(currentMonth, 1))}><Ionicons name="chevron-forward" size={28} color="#fff" /></TouchableOpacity>
</View>
<View style={{ flexDirection: 'row', marginBottom: 4 }}>
{["H", "K", "Sz", "Cs", "P", "Szo", "V"].map(d => (
<Text key={d} style={{ flex: 1, color: '#bdbdbd', textAlign: 'center', fontWeight: 'bold' }}>{d}</Text>
))}
</View>
{loading ? (
<Text style={{ color: '#fff', textAlign: 'center', marginTop: 24 }}>Betöltés</Text>
) : (
<View>{rows}</View>
)}
</View>
);
}
function renderContent() {
if (activeTab === 'profile') {
return (
<View style={styles.card}>
<Text style={styles.label}>Név:</Text>
<Text style={styles.value}>{fullName}</Text>
<Text style={styles.label}>Email:</Text>
<Text style={styles.value}>{email}</Text>
<Text style={styles.label}>UserID:</Text>
<Text style={styles.value}>{userId}</Text>
<TouchableOpacity style={styles.logoutButton} onPress={handleLogout}>
<Text style={styles.logoutText}>Kijelentkezés</Text>
</TouchableOpacity>
</View>
);
} else if (activeTab === 'schedule') {
return (
<ScrollView style={{ width: '100%' }} contentContainerStyle={{ alignItems: 'center' }}>
<View style={styles.card}>
<Text style={styles.label}>Beosztás naptár</Text>
{renderCalendar()}
</View>
</ScrollView>
);
} else if (activeTab === 'requests') {
return (
<View style={styles.card}>
<Text style={styles.value}>Kérelmek funkció hamarosan</Text>
</View>
);
}
}
return ( return (
<View style={styles.container}> <View style={styles.container}>
<Text style={styles.title}>Profil</Text> <Text style={styles.title}>Profil</Text>
{renderContent()} <View style={styles.card}>
<View style={styles.navBar}> <Text style={styles.label}>Név:</Text>
{NAV_ITEMS.map(item => ( <Text style={styles.value}>{fullName}</Text>
<TouchableOpacity <Text style={styles.label}>Email:</Text>
key={item.key} <Text style={styles.value}>{email}</Text>
style={styles.navItem} <Text style={styles.label}>UserID:</Text>
onPress={() => setActiveTab(item.key)} <Text style={styles.value}>{userId}</Text>
> <TouchableOpacity style={styles.logoutButton} onPress={handleLogout}>
{item.icon(activeTab === item.key ? PRIMARY : '#bdbdbd')} <Text style={styles.logoutText}>Kijelentkezés</Text>
<Text style={[styles.navLabel, { color: activeTab === item.key ? PRIMARY : '#bdbdbd' }]}>{item.label}</Text> </TouchableOpacity>
</TouchableOpacity>
))}
</View> </View>
<View style={styles.navBar}>
<NavBar activeTab="profile" />
</View>
</View>
);
}
function NavBar({ activeTab }: { activeTab: string }) {
const router = useRouter();
return (
<View style={styles.navBar}>
<TouchableOpacity style={styles.navItem} onPress={() => router.push('/profile')}>
<MaterialIcons name="person" size={28} color={activeTab === 'profile' ? PRIMARY : '#bdbdbd'} />
<Text style={[styles.navLabel, { color: activeTab === 'profile' ? PRIMARY : '#bdbdbd' }]}>Profilom</Text>
</TouchableOpacity>
<TouchableOpacity style={styles.navItem} onPress={() => router.push('/schedule')}>
<MaterialCommunityIcons name="calendar-month" size={28} color={activeTab === 'schedule' ? PRIMARY : '#bdbdbd'} />
<Text style={[styles.navLabel, { color: activeTab === 'schedule' ? PRIMARY : '#bdbdbd' }]}>Beosztás</Text>
</TouchableOpacity>
<TouchableOpacity style={styles.navItem} onPress={() => router.push('/requests')}>
<Ionicons name="mail" size={28} color={activeTab === 'requests' ? PRIMARY : '#bdbdbd'} />
<Text style={[styles.navLabel, { color: activeTab === 'requests' ? PRIMARY : '#bdbdbd' }]}>Kérelmek</Text>
</TouchableOpacity>
</View> </View>
); );
} }

View File

@@ -1,7 +1,3 @@
// Csak a név=érték részt tartjuk meg a cookie stringből
function extractCookie(cookieStr: string) {
return cookieStr.split(';')[0];
}
import { Ionicons, MaterialCommunityIcons, MaterialIcons } from '@expo/vector-icons'; import { Ionicons, MaterialCommunityIcons, MaterialIcons } from '@expo/vector-icons';
import axios from 'axios'; import axios from 'axios';
import { addDays, addMonths, endOfMonth, endOfWeek, format, getMonth, getYear, isSameDay, startOfMonth, startOfWeek, subMonths } from 'date-fns'; import { addDays, addMonths, endOfMonth, endOfWeek, format, getMonth, getYear, isSameDay, startOfMonth, startOfWeek, subMonths } from 'date-fns';
@@ -14,227 +10,227 @@ const PRIMARY = '#A24BFA';
const BG = '#0c0a0a'; const BG = '#0c0a0a';
export default function Schedule() { export default function Schedule() {
const [currentMonth, setCurrentMonth] = useState(new Date()); const [currentMonth, setCurrentMonth] = useState(new Date());
const [workdays, setWorkdays] = useState<any[]>([]); const [workdays, setWorkdays] = useState<any[]>([]);
const [loading, setLoading] = useState(false); const [loading, setLoading] = useState(false);
const router = useRouter(); const router = useRouter();
useEffect(() => { useEffect(() => {
fetchWorkdays(); fetchWorkdays();
}, [currentMonth]); }, [currentMonth]);
async function fetchWorkdays() { async function fetchWorkdays() {
setLoading(true); setLoading(true);
try { try {
const userCookie = await SecureStore.getItemAsync('cookie'); const userCookieRaw = await SecureStore.getItemAsync('cookie');
const year = getYear(currentMonth); if (!userCookieRaw) {
const month = getMonth(currentMonth) + 1; throw new Error('Nincs elmentett cookie, kérlek jelentkezz be újra!');
console.log('Lekérdezett hónap:', year, month); }
console.log('Cookie:', userCookie); console.log('Lekért cookie:', userCookieRaw);
if (!userCookie) {
console.log('Nincs elmentett cookie, nem vagy bejelentkezve!');
setWorkdays([]);
return;
}
console.log('Beosztás API hívás:', { year, month }); const userCookie = userCookieRaw.split(';')[0];
const year = getYear(currentMonth);
const month = getMonth(currentMonth) + 1;
console.log('Lekérdezett hónap:', year, month);
console.log('Beosztás API hívás:', { year, month });
console.log('Küldött cookie:', userCookie);
const response = await axios.post( const response = await axios.post(
'https://mymenu.mcdonalds.hu/api/UserDataApi/GetWorkDayMonthList', 'https://mymenu.mcdonalds.hu/api/UserDataApi/GetWorkDayMonthList',
{ Data: { Year: year, Month: month } }, { Data: { Year: year, Month: month } },
{ {
headers: { headers: {
'Content-Type': 'application/json', 'Content-Type': 'application/json',
'cookie': userCookie, 'cookie': userCookie,
'origin': 'https://mymenu.mcdonalds.hu', 'Origin': 'https://mymenu.mcdonalds.hu',
} 'Referer': 'https://mymenu.mcdonalds.hu/',
'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Safari/537.36',
'Accept': 'application/json, text/plain, */*',
'Accept-Language': 'hu-HU,hu;q=0.9',
}
}
);
const cookie = response.headers['set-cookie']?.join('; ');
if (cookie) {
await SecureStore.setItemAsync('cookie', cookie);
} else {
console.warn('Nincs set-cookie fejléc a válaszban!');
}
console.log('API teljes válasz:', response.data);
if (!response.data || !response.data.data || !response.data.data.Data) {
console.log('Nincs beosztás adat a válaszban!');
setWorkdays([]);
return;
}
setWorkdays(response.data.data.Data);
} catch (e) {
const err = e as any;
if (err.response) {
console.log('API válasz hiba:', err.response.data);
} else {
console.log('Beosztás API hiba:', e);
}
setWorkdays([]);
} finally {
setLoading(false);
} }
);
// Cookie frissítés, ha van új set-cookie header
const setCookieHeader = response.headers && (response.headers['set-cookie'] || response.headers['Set-Cookie']);
if (setCookieHeader) {
let cookieString = '';
if (Array.isArray(setCookieHeader)) {
// Ha van .ASPXAUTH, azt mentsük el, különben az elsőt
const authCookie = setCookieHeader.find(c => c.startsWith('.ASPXAUTH='));
if (authCookie) {
cookieString = extractCookie(authCookie);
} else {
cookieString = extractCookie(setCookieHeader[0]);
}
} else {
cookieString = extractCookie(setCookieHeader);
}
console.log('Frissített cookie:', cookieString);
await SecureStore.setItemAsync('cookie', cookieString);
}
console.log('API teljes válasz:', response.data);
if (!response.data || !response.data.data || !response.data.data.Data) {
console.log('Nincs beosztás adat a válaszban!');
setWorkdays([]);
return;
}
setWorkdays(response.data.data.Data);
} catch (e) {
console.log('Beosztás API hiba:', e);
setWorkdays([]);
} finally {
setLoading(false);
} }
}
function renderCalendar() { function renderCalendar() {
const monthStart = startOfMonth(currentMonth); const monthStart = startOfMonth(currentMonth);
const monthEnd = endOfMonth(monthStart); const monthEnd = endOfMonth(monthStart);
const startDate = startOfWeek(monthStart, { weekStartsOn: 1 }); const startDate = startOfWeek(monthStart, { weekStartsOn: 1 });
const endDate = endOfWeek(monthEnd, { weekStartsOn: 1 }); const endDate = endOfWeek(monthEnd, { weekStartsOn: 1 });
const today = new Date(); const today = new Date();
const rows = []; const rows = [];
let days = []; let days = [];
let day = startDate; let day = startDate;
let formattedDate = ''; let formattedDate = '';
while (day <= endDate) { while (day <= endDate) {
for (let i = 0; i < 7; i++) { for (let i = 0; i < 7; i++) {
formattedDate = format(day, 'yyyy-MM-dd'); formattedDate = format(day, 'yyyy-MM-dd');
const wd = workdays.find(w => w.WorkDay?.slice(0, 10) === formattedDate); const wd = workdays.find(w => w.WorkDay?.slice(0, 10) === formattedDate);
let bg = 'rgba(24,20,28,0.7)'; let bg = 'rgba(24,20,28,0.7)';
let color = '#fff'; let color = '#fff';
let borderWidth = 0; let borderWidth = 0;
if (isSameDay(day, today)) { if (isSameDay(day, today)) {
borderWidth = 2; borderWidth = 2;
color = PRIMARY; color = PRIMARY;
}
if (wd) {
bg = wd.color || 'deepskyblue';
color = '#222';
}
days.push(
<View key={day.toString()} style={{ flex: 1, aspectRatio: 1, margin: 2 }}>
<View style={{
backgroundColor: bg,
borderRadius: 8,
borderWidth,
borderColor: PRIMARY,
justifyContent: 'center',
alignItems: 'center',
flex: 1,
}}>
<Text style={{ color, fontWeight: isSameDay(day, today) ? 'bold' : 'normal' }}>{format(day, 'd')}</Text>
{wd && <Text style={{ color, fontSize: 10 }}>{wd.text}</Text>}
</View>
</View>
);
day = addDays(day, 1);
}
rows.push(<View key={day.toString()} style={{ flexDirection: 'row' }}>{days}</View>);
days = [];
} }
if (wd) { return (
bg = wd.color || 'deepskyblue'; <View>
color = '#222'; <View style={{ flexDirection: 'row', alignItems: 'center', justifyContent: 'space-between', marginBottom: 12 }}>
} <TouchableOpacity onPress={() => setCurrentMonth(subMonths(currentMonth, 1))}><Ionicons name="chevron-back" size={28} color="#fff" /></TouchableOpacity>
days.push( <Text style={{ color: '#fff', fontSize: 18, fontWeight: 'bold' }}>{format(currentMonth, 'yyyy. MMMM')}</Text>
<View key={day.toString()} style={{ flex: 1, aspectRatio: 1, margin: 2 }}> <TouchableOpacity onPress={() => setCurrentMonth(addMonths(currentMonth, 1))}><Ionicons name="chevron-forward" size={28} color="#fff" /></TouchableOpacity>
<View style={{ </View>
backgroundColor: bg, <View style={{ flexDirection: 'row', marginBottom: 4 }}>
borderRadius: 8, {["H", "K", "Sz", "Cs", "P", "Szo", "V"].map(d => (
borderWidth, <Text key={d} style={{ flex: 1, color: '#bdbdbd', textAlign: 'center', fontWeight: 'bold' }}>{d}</Text>
borderColor: PRIMARY, ))}
justifyContent: 'center', </View>
alignItems: 'center', {loading ? (
flex: 1, <Text style={{ color: '#fff', textAlign: 'center', marginTop: 24 }}>Betöltés</Text>
}}> ) : (
<Text style={{ color, fontWeight: isSameDay(day, today) ? 'bold' : 'normal' }}>{format(day, 'd')}</Text> <View>{rows}</View>
{wd && <Text style={{ color, fontSize: 10 }}>{wd.text}</Text>} )}
</View> </View>
</View>
); );
day = addDays(day, 1);
}
rows.push(<View key={day.toString()} style={{ flexDirection: 'row' }}>{days}</View>);
days = [];
} }
return (
<View>
<View style={{ flexDirection: 'row', alignItems: 'center', justifyContent: 'space-between', marginBottom: 12 }}>
<TouchableOpacity onPress={() => setCurrentMonth(subMonths(currentMonth, 1))}><Ionicons name="chevron-back" size={28} color="#fff" /></TouchableOpacity>
<Text style={{ color: '#fff', fontSize: 18, fontWeight: 'bold' }}>{format(currentMonth, 'yyyy. MMMM')}</Text>
<TouchableOpacity onPress={() => setCurrentMonth(addMonths(currentMonth, 1))}><Ionicons name="chevron-forward" size={28} color="#fff" /></TouchableOpacity>
</View>
<View style={{ flexDirection: 'row', marginBottom: 4 }}>
{["H", "K", "Sz", "Cs", "P", "Szo", "V"].map(d => (
<Text key={d} style={{ flex: 1, color: '#bdbdbd', textAlign: 'center', fontWeight: 'bold' }}>{d}</Text>
))}
</View>
{loading ? (
<Text style={{ color: '#fff', textAlign: 'center', marginTop: 24 }}>Betöltés</Text>
) : (
<View>{rows}</View>
)}
</View>
);
}
return ( return (
<ScrollView style={{ flex: 1, backgroundColor: BG }} contentContainerStyle={{ flexGrow: 1, justifyContent: 'center', alignItems: 'center', minHeight: '100%', paddingBottom: 80 }}> <ScrollView style={{ flex: 1, backgroundColor: BG }} contentContainerStyle={{ flexGrow: 1, justifyContent: 'center', alignItems: 'center', minHeight: '100%', paddingBottom: 80 }}>
<View style={{ flex: 1, justifyContent: 'center', alignItems: 'center', width: '100%' }}> <View style={{ flex: 1, justifyContent: 'center', alignItems: 'center', width: '100%' }}>
<View style={[styles.card, { alignSelf: 'center', marginTop: 48, marginBottom: 48 }]}> <View style={[styles.card, { alignSelf: 'center', marginTop: 48, marginBottom: 48 }]}>
<Text style={styles.label}>Beosztás naptár</Text> <Text style={styles.label}>Beosztás naptár</Text>
{/* Hibaüzenet, ha nincs bejelentkezve vagy nincs beosztás */} {/* Hibaüzenet, ha nincs bejelentkezve vagy nincs beosztás */}
{(!loading && workdays.length === 0) && ( {(!loading && workdays.length === 0) && (
<Text style={{ color: '#ff5252', textAlign: 'center', marginBottom: 12, fontWeight: 'bold' }}> <Text style={{ color: '#ff5252', textAlign: 'center', marginBottom: 12, fontWeight: 'bold' }}>
Nincs beosztás vagy nem vagy bejelentkezve! Nincs beosztás vagy nem vagy bejelentkezve!
</Text> </Text>
)} )}
{renderCalendar()} {renderCalendar()}
</View> </View>
</View> </View>
<View style={styles.navBar}> <View style={styles.navBar}>
<NavBar activeTab="schedule" /> <NavBar activeTab="schedule" />
</View> </View>
</ScrollView> </ScrollView>
); );
} }
function NavBar({ activeTab }: { activeTab: string }) { function NavBar({ activeTab }: { activeTab: string }) {
const router = useRouter(); const router = useRouter();
return ( return (
<View style={styles.navBar}> <View style={styles.navBar}>
<TouchableOpacity style={styles.navItem} onPress={() => router.push('/profile')}> <TouchableOpacity style={styles.navItem} onPress={() => router.push('/profile')}>
<MaterialIcons name="person" size={28} color={activeTab === 'profile' ? PRIMARY : '#bdbdbd'} /> <MaterialIcons name="person" size={28} color={activeTab === 'profile' ? PRIMARY : '#bdbdbd'} />
<Text style={[styles.navLabel, { color: activeTab === 'profile' ? PRIMARY : '#bdbdbd' }]}>Profilom</Text> <Text style={[styles.navLabel, { color: activeTab === 'profile' ? PRIMARY : '#bdbdbd' }]}>Profilom</Text>
</TouchableOpacity> </TouchableOpacity>
<TouchableOpacity style={styles.navItem} onPress={() => router.push('/schedule')}> <TouchableOpacity style={styles.navItem} onPress={() => router.push('/schedule')}>
<MaterialCommunityIcons name="calendar-month" size={28} color={activeTab === 'schedule' ? PRIMARY : '#bdbdbd'} /> <MaterialCommunityIcons name="calendar-month" size={28} color={activeTab === 'schedule' ? PRIMARY : '#bdbdbd'} />
<Text style={[styles.navLabel, { color: activeTab === 'schedule' ? PRIMARY : '#bdbdbd' }]}>Beosztás</Text> <Text style={[styles.navLabel, { color: activeTab === 'schedule' ? PRIMARY : '#bdbdbd' }]}>Beosztás</Text>
</TouchableOpacity> </TouchableOpacity>
<TouchableOpacity style={styles.navItem} onPress={() => router.push('/requests')}> <TouchableOpacity style={styles.navItem} onPress={() => router.push('/requests')}>
<Ionicons name="mail" size={28} color={activeTab === 'requests' ? PRIMARY : '#bdbdbd'} /> <Ionicons name="mail" size={28} color={activeTab === 'requests' ? PRIMARY : '#bdbdbd'} />
<Text style={[styles.navLabel, { color: activeTab === 'requests' ? PRIMARY : '#bdbdbd' }]}>Kérelmek</Text> <Text style={[styles.navLabel, { color: activeTab === 'requests' ? PRIMARY : '#bdbdbd' }]}>Kérelmek</Text>
</TouchableOpacity> </TouchableOpacity>
</View> </View>
); );
} }
const styles = StyleSheet.create({ const styles = StyleSheet.create({
card: { card: {
backgroundColor: 'rgba(24, 20, 28, 0.95)', backgroundColor: 'rgba(24, 20, 28, 0.95)',
borderRadius: 24, borderRadius: 24,
padding: 32, padding: 32,
width: '90%', width: '90%',
maxWidth: 400, maxWidth: 400,
shadowColor: '#000', shadowColor: '#000',
shadowOpacity: 0.3, shadowOpacity: 0.3,
shadowRadius: 24, shadowRadius: 24,
shadowOffset: { width: 0, height: 8 }, shadowOffset: { width: 0, height: 8 },
elevation: 8, elevation: 8,
marginBottom: 32, marginBottom: 32,
marginTop: 32, marginTop: 32,
}, },
label: { label: {
color: '#bdbdbd', color: '#bdbdbd',
fontSize: 16, fontSize: 16,
marginBottom: 16, marginBottom: 16,
fontWeight: 'bold', fontWeight: 'bold',
textAlign: 'center', textAlign: 'center',
}, },
navBar: { navBar: {
flexDirection: 'row', flexDirection: 'row',
justifyContent: 'space-around', justifyContent: 'space-around',
alignItems: 'center', alignItems: 'center',
backgroundColor: 'rgba(24, 20, 28, 0.98)', backgroundColor: 'rgba(24, 20, 28, 0.98)',
borderTopWidth: 1, borderTopWidth: 1,
borderTopColor: '#222', borderTopColor: '#222',
position: 'absolute', position: 'absolute',
bottom: 0, bottom: 0,
left: 0, left: 0,
right: 0, right: 0,
height: 64, height: 64,
paddingHorizontal: 16, paddingHorizontal: 16,
}, },
navItem: { navItem: {
flex: 1, flex: 1,
alignItems: 'center', alignItems: 'center',
justifyContent: 'center', justifyContent: 'center',
}, },
navLabel: { navLabel: {
fontSize: 13, fontSize: 13,
marginTop: 2, marginTop: 2,
fontWeight: 'bold', fontWeight: 'bold',
}, },
}); });

21
eas.json Normal file
View File

@@ -0,0 +1,21 @@
{
"cli": {
"version": ">= 16.17.3",
"appVersionSource": "remote"
},
"build": {
"development": {
"developmentClient": true,
"distribution": "internal"
},
"preview": {
"distribution": "internal"
},
"production": {
"autoIncrement": true
}
},
"submit": {
"production": {}
}
}

View File

@@ -4,7 +4,6 @@
"version": "1.0.0", "version": "1.0.0",
"scripts": { "scripts": {
"start": "expo start", "start": "expo start",
"reset-project": "node ./scripts/reset-project.js",
"android": "expo run:android", "android": "expo run:android",
"ios": "expo run:ios", "ios": "expo run:ios",
"web": "expo start --web", "web": "expo start --web",