Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions mobile/app/projects/[id].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -146,29 +146,29 @@ export default function ProjectDetailScreen() {

if (loading) {
return (
<View style={[styles.container, { backgroundColor: colors.background }]}>
<View style={[styles.container, { backgroundColor: colors.background }]}>
<Text style={[styles.loadingText, { color: colors.secondaryText }]}>Loading project...</Text>
</View>
);
}

if (!project) {
return (
<View style={[styles.container, { backgroundColor: colors.background }]}>
<View style={[styles.container, { backgroundColor: colors.background }]}>
<Text style={[styles.errorText, { color: colors.secondaryText }]}>Project not found</Text>
</View>
);
}

return (
<ScrollView style={[styles.container, { backgroundColor: colors.background }]}>
<View style={[styles.header, { backgroundColor: colors.primary }]}>
<ScrollView style={[styles.container, { backgroundColor: colors.background }]}>
<View style={[styles.header, { backgroundColor: colors.primary }]}>
<Text style={[styles.category, { color: colors.headerText }]}>{project.category}</Text>
<Text style={[styles.name, { color: colors.headerText }]}>{project.name}</Text>
<Text style={[styles.location, { color: colors.headerText }]}>📍 {project.location}</Text>
</View>

<View style={[styles.statsCard, { backgroundColor: colors.surface, shadowColor: colors.cardShadow, borderColor: colors.cardBorder }]}>
<View style={[styles.statsCard, { backgroundColor: colors.surface, shadowColor: colors.cardShadow, borderColor: colors.cardBorder }]}>
<View style={styles.statRow}>
<View style={styles.stat}>
<Text style={[styles.statValue, { color: colors.accent }]}>{parseFloat(project.raisedXLM).toFixed(2)}</Text>
Expand All @@ -185,20 +185,20 @@ export default function ProjectDetailScreen() {
</View>
</View>

<View style={[styles.progressCard, { backgroundColor: colors.surface, shadowColor: colors.cardShadow, borderColor: colors.cardBorder }]}>
<View style={[styles.progressCard, { backgroundColor: colors.surface, shadowColor: colors.cardShadow, borderColor: colors.cardBorder }]}>
<Text style={[styles.progressTitle, { color: colors.primaryText }]}>Fundraising Progress</Text>
<View style={[styles.progressBar, { backgroundColor: colors.border }]}>
<View style={[styles.progressBar, { backgroundColor: colors.border }]}>
<View
style={[
styles.progressFill,
{ width: `${progressPercent(project.raisedXLM, project.goalXLM)}%`, backgroundColor: colors.primary }
]}
/>
</View>
<Text style={[styles.progressText, { color: colors.secondaryText }]}>
<Text style={[styles.progressText, { color: colors.secondaryText }]}>
{progressPercent(project.raisedXLM, project.goalXLM)}% complete
</Text>
<Text style={[styles.goalText, { color: colors.muted }]}>
<Text style={[styles.goalText, { color: colors.muted }]}>
Goal: {parseFloat(project.goalXLM).toFixed(2)} XLM
</Text>
</View>
Expand Down
18 changes: 9 additions & 9 deletions mobile/utils/notifications.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,17 +152,17 @@ export async function checkNotificationPermissions(): Promise<NotificationPermis
export async function requestNotificationPermissions(): Promise<string | null> {
const { status: existingStatus, canAskAgain } = await Notifications.getPermissionsAsync();
let finalStatus = existingStatus;

if (existingStatus !== 'granted' && canAskAgain !== false) {
const { status } = await Notifications.requestPermissionsAsync();
finalStatus = status;
}

if (finalStatus !== 'granted') {
console.log('Push notification permission denied by user');
return null;
}

return finalStatus;
}

Expand Down Expand Up @@ -232,11 +232,11 @@ export async function getPushToken(): Promise<string | null> {
await setupNotificationChannel();
const permissionStatus = await requestNotificationPermissions();
if (!permissionStatus) return null;

const tokenResult = await Notifications.getExpoPushTokenAsync({
projectId: process.env.EXPO_PUBLIC_PROJECT_ID || '',
});

const token = tokenResult?.data;
if (token) {
await saveStoredPushToken(token);
Expand All @@ -257,7 +257,7 @@ export async function registerDeviceToken(
): Promise<boolean> {
try {
const platform = Platform.OS;

const registered = await postJson('/api/notifications/register', {
token,
platform,
Expand Down Expand Up @@ -348,7 +348,7 @@ export async function followProject(
});

if (!followed) return false;

console.log(`Followed project ${projectId}`);
return true;
} catch (error) {
Expand All @@ -371,7 +371,7 @@ export async function unfollowProject(
});

if (!unfollowed) return false;

console.log(`Unfollowed project ${projectId}`);
return true;
} catch (error) {
Expand Down Expand Up @@ -433,7 +433,7 @@ export function setupNotificationListener(options?: {
retryPendingRegistration();
}
});

return {
remove: () => {
notificationSubscription.remove();
Expand Down
Loading