Skip to content
Merged
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
7 changes: 0 additions & 7 deletions app/(auth)/(home)/_layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,6 @@ function HomeLayout() {
tabBarButton: (props) => <TabBarButton {...props} />,
}}
>
<Tabs.Screen
name="index"
options={{
headerShown: false,
href: null,
}}
/>
<Tabs.Screen
name="projects"
options={{
Expand Down
52 changes: 19 additions & 33 deletions app/(auth)/(home)/profile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import {
} from 'react';
import { useTranslation } from 'react-i18next';
import {
Alert,
Linking,
RefreshControl,
ScrollView,
Expand All @@ -27,6 +26,7 @@ import InlineListView from '@/components/InlineListView';
import Page from '@/components/Page';
import ProfileHeader from '@/components/ProfileHeader';
import ProfileStats from '@/components/ProfileStats';
import showConfirm from '@/components/showConfirm';
import Text from '@/components/Text';
import { showAlert } from '@/components/Toast';
import {
Expand Down Expand Up @@ -158,26 +158,21 @@ function Profile() {
}, []);

const onHandleSignoutClick = useCallback(() => {
Alert.alert('Sign Out', 'Are you sure you want to sign out?', [
{
text: 'Cancel',
style: 'cancel',
},
{
text: 'OK',
style: 'destructive',
onPress: () => {
firebaseAuth.signOut().catch((error) => {
showAlert({
title: 'Sign out error',
message: error,
alertType: 'error',
});
showConfirm({
title: 'Sign Out',
message: 'Are you sure you want to sign out?',
onConfirm: () => {
firebaseAuth.signOut().catch((error) => {
showAlert({
title: 'Sign out error',
message: error,
alertType: 'error',
});
router.replace('/');
},
});
router.replace('/');
},
]);
destructive: true,
});
}, [router]);

const handleResetPress = useCallback(async () => {
Expand All @@ -201,20 +196,11 @@ function Profile() {
}, [handleAsync, user, t]);

const handleResetPasswordClick = useCallback(() => {
Alert.alert(
'Reset Password',
'An email will be sent to your account with the reset link. Are you sure you want to continue?',
[
{
text: 'Cancel',
style: 'cancel',
},
{
text: 'OK',
onPress: handleResetPress,
},
],
);
showConfirm({
title: 'Reset Password',
message: 'An email will be sent to your account with the reset link. Are you sure you want to continue?',
onConfirm: handleResetPress,
});
}, [handleResetPress]);

const settingItems: ButtonLayoutProps[] = [
Expand Down
3 changes: 2 additions & 1 deletion app/(auth)/(home)/projects.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ import {
PROJECT_TYPE_COMPARE,
PROJECT_TYPE_COMPLETENESS,
PROJECT_TYPE_FIND,
PROJECT_TYPE_LOCATE_FEATURES,
PROJECT_TYPE_STREET,
PROJECT_TYPE_VALIDATE,
PROJECT_TYPE_VALIDATE_IMAGE,
Expand Down Expand Up @@ -90,7 +91,6 @@ const createProjectStyles = (_: AppTheme, { featured }: { featured: boolean }) =
},
projectImage: {
height: 220,
aspectRatio: 1,
},
overlay: {
top: 0,
Expand Down Expand Up @@ -147,6 +147,7 @@ const projectTypeTextMapping: Record<FbProject['projectType'], string> = {
[PROJECT_TYPE_VALIDATE]: 'validate',
[PROJECT_TYPE_STREET]: 'street',
[PROJECT_TYPE_VALIDATE_IMAGE]: 'validate image',
[PROJECT_TYPE_LOCATE_FEATURES]: 'locate features',
};

interface ProjectItemProps {
Expand Down
14 changes: 5 additions & 9 deletions app/(auth)/exploreGroup/[id]/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
} from 'react';
import { useTranslation } from 'react-i18next';
import {
Alert,
Linking,
RefreshControl,
ScrollView,
Expand All @@ -29,6 +28,7 @@
import InfoCard, { StatsInfo } from '@/components/InfoCard';
import InlineListView from '@/components/InlineListView';
import Page from '@/components/Page';
import showConfirm from '@/components/showConfirm';
import Text from '@/components/Text';
import { showAlert } from '@/components/Toast';
import {
Expand Down Expand Up @@ -196,7 +196,7 @@
(action: UserGroupAction) => {
const isJoin = action === 'join';

const message = isJoin

Check warning on line 199 in app/(auth)/exploreGroup/[id]/index.tsx

View workflow job for this annotation

GitHub Actions / 🚴 Lint + Typecheck 🚴

'message' is assigned a value but never used
? 'Are you sure you want to join this group?'
: 'Are you sure you want to leave this group?\n\nAfter you leave, you will still remain on the leaderboard. Contributions made while a member will still count, but contributions after leaving will not.';

Expand Down Expand Up @@ -239,14 +239,10 @@
});
}
};
Alert.alert(
isJoin ? 'Join User Group' : 'Leave User Group',
message,
[
{ text: 'Cancel', style: 'cancel' },
{ text: 'OK', onPress: proceed },
],
);
showConfirm({
title: isJoin ? 'Join User Group' : 'Leave User Group',
onConfirm: proceed,
});
},
[userId, userGroupId, router],
);
Expand Down
1 change: 1 addition & 0 deletions app/(auth)/project/[id]/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ const createStyles = (theme: AppTheme) => StyleSheet.create({
},
contributionText: {
color: theme.card,
flexShrink: 1,
},
bottomBar: {
borderTopWidth: 1,
Expand Down
11 changes: 11 additions & 0 deletions app/(auth)/project/[id]/map/[taskGroupId].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import { isNotDefined } from '@togglecorp/fujs';
import { set as setToDatabase } from 'firebase/database';

import CompareMappingSession from '@/components/CompareMappingSession';
import LocateFeaturesMappingSession from '@/components/LocateFeaturesMappingSession';
import Page from '@/components/Page';
import SessionOutro, { type ResultSyncStatus } from '@/components/SessionOutro';
import StreetMappingSession from '@/components/StreetMappingSession';
Expand All @@ -27,6 +28,7 @@ import {
PROJECT_TYPE_COMPARE,
PROJECT_TYPE_COMPLETENESS,
PROJECT_TYPE_FIND,
PROJECT_TYPE_LOCATE_FEATURES,
PROJECT_TYPE_STREET,
PROJECT_TYPE_VALIDATE,
PROJECT_TYPE_VALIDATE_IMAGE,
Expand Down Expand Up @@ -205,6 +207,15 @@ function MapTaskGroup() {
projectDetails={projectDetails}
/>
)}
{projectDetails?.projectType === PROJECT_TYPE_LOCATE_FEATURES && (
<LocateFeaturesMappingSession
taskGroupId={taskGroupId}
projectDetails={projectDetails}
results={results}
onResultsChange={setResults}
onSessionComplete={handleSessionComplete}
/>
)}
</>
)}
</Page>
Expand Down
5 changes: 5 additions & 0 deletions app/(auth)/project/[id]/tutorial.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,11 @@ function Tutorial() {
attemptCounts={attemptCounts}
onScenarioSubmit={handleScenarioSubmit}
onScenarioShowAnswers={handleScenarioShowAnswers}
projectCustomOptions={
projectDetails && 'customOptions' in projectDetails
? projectDetails.customOptions
: undefined
}
/>
)}
</Page>
Expand Down
4 changes: 3 additions & 1 deletion app/(auth)/project/_layout.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { Stack } from 'expo-router';

export default function ProjectLayout() {
return <Stack screenOptions={{ headerShown: false }} />;
return (
<Stack screenOptions={{ headerShown: false }} />
);
}
12 changes: 5 additions & 7 deletions app/login.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,11 @@ import useThemedStyles from '@/hooks/useThemedStyles';
import { firebaseAuth } from '@/utils/firebase';

const createStyles = (theme: AppTheme) => StyleSheet.create({
mainContent: {
flexDirection: 'column',
gap: 48,
},
icon: {
width: 128,
height: 128,
},
page: {
logoContainer: {
paddingTop: 96,
},
text: {
Expand Down Expand Up @@ -87,12 +83,14 @@ function Login() {
<Page
title="Login"
variant="brand"
style={styles.page}
>
<BlockListView
spacing="sm"
>
<BlockListView withCenteredContent>
<BlockListView
withCenteredContent
style={styles.logoContainer}
>
<Image
style={styles.icon}
source={logo}
Expand Down
12 changes: 5 additions & 7 deletions app/register.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,11 @@ import {
} from '@/utils/firebase';

const createStyles = (theme: AppTheme) => StyleSheet.create({
mainContent: {
flexDirection: 'column',
gap: 48,
},
icon: {
width: 128,
height: 128,
},
page: {
logoContainer: {
paddingTop: 96,
},
text: {
Expand Down Expand Up @@ -183,12 +179,14 @@ function Register() {
<Page
title="Register"
variant="brand"
style={styles.page}
>
<BlockListView
spacing="sm"
>
<BlockListView withCenteredContent>
<BlockListView
withCenteredContent
style={styles.logoContainer}
>
<Image
style={styles.icon}
source={logo}
Expand Down
2 changes: 1 addition & 1 deletion backend
Submodule backend updated 49 files
+47 −0 CHANGELOG.md
+40 −16 apps/mapping/firebase/utils.py
+32 −0 apps/mapping/migrations/0004_alter_mappingsessionresult_unique_together_and_more.py
+3 −1 apps/mapping/models.py
+28 −0 apps/project/custom_options.py
+4 −9 apps/project/exports/exports.py
+8 −1 apps/project/exports/mapping_results.py
+18 −2 apps/project/exports/mapping_results_aggregate/task.py
+12 −2 apps/project/exports/mapping_results_aggregate/user.py
+2 −0 apps/project/graphql/inputs/inputs.py
+7 −0 apps/project/graphql/inputs/project_types/locate.py
+7 −0 apps/project/graphql/types/project_types/locate.py
+8 −0 apps/project/graphql/types/types.py
+19 −0 apps/project/migrations/0011_alter_project_project_type.py
+5 −0 apps/project/models.py
+4 −0 apps/project/serializers.py
+92 −57 apps/project/tests/e2e_create_project_tile_map_service_test.py
+7 −1 apps/project/tests/e2e_create_street_project_test.py
+338 −0 apps/project/tests/mutation_test.py
+1 −0 apps/tutorial/factories.py
+4 −0 apps/tutorial/graphql/inputs/inputs.py
+7 −0 apps/tutorial/graphql/inputs/project_types/locate.py
+7 −0 apps/tutorial/graphql/types/project_types/locate.py
+9 −0 apps/tutorial/graphql/types/types.py
+18 −0 apps/tutorial/migrations/0003_tutorialtask_task_partition_index.py
+2 −0 apps/tutorial/models.py
+44 −0 apps/tutorial/serializers.py
+353 −0 apps/tutorial/tests/mutation_test.py
+1 −1 assets
+1 −1 firebase
+1 −1 helm/Chart.yaml
+8 −0 main/config.py
+2 −0 main/graphql/enums.py
+3 −0 project_types/base/project.py
+36 −3 project_types/store.py
+1 −1 project_types/street/api_calls.py
+1 −1 project_types/street/project.py
+1 −0 project_types/tile_map_service/base/tutorial.py
+4 −0 project_types/tile_map_service/compare/project.py
+4 −0 project_types/tile_map_service/completeness/project.py
+4 −0 project_types/tile_map_service/find/project.py
+0 −0 project_types/tile_map_service/locate/__init__.py
+112 −0 project_types/tile_map_service/locate/project.py
+72 −0 project_types/tile_map_service/locate/tutorial.py
+1 −1 project_types/validate/api_calls.py
+1 −1 pyproject.toml
+70 −14 schema.graphql
+4 −2 utils/fields.py
+1 −1 uv.lock
6 changes: 6 additions & 0 deletions components/ButtonLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,9 @@ const createStyles = (
disabled: {
opacity: 0.4,
},
leftContent: {
marginRight: 'auto',
},
rightContent: {
marginLeft: 'auto',
},
Expand All @@ -112,6 +115,7 @@ export interface ButtonLayoutProps extends Omit<InlineLayoutProps, 'withPadding'
title?: string;
fullWidth?: boolean;
onPress?: () => void;
icon?: React.ReactNode;
children?: React.ReactNode;
action?: React.ReactNode
accessibilityLabel?: string;
Expand All @@ -124,6 +128,7 @@ function ButtonLayout(props: ButtonLayoutProps) {
spacingOffset = -1,
withoutPadding = false,
disabled,
icon,
iconName,
title,
onPress,
Expand Down Expand Up @@ -167,6 +172,7 @@ function ButtonLayout(props: ButtonLayoutProps) {
{...inlineLayoutProps}
withCenteredContent={styleVariant !== 'block'}
>
{icon && <View style={styles.leftContent}>{icon}</View>}
{isDefined(iconName) && (
<Icon
style={styles.icon}
Expand Down
13 changes: 8 additions & 5 deletions components/CompareMappingSession.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -147,10 +147,13 @@ function CompareMappingSession(props: Props) {
}, [options]);

const handleTilePress = useCallback((taskId: string) => {
onResultsChange((prevResults) => ({
...prevResults,
[taskId]: getNextValue(prevResults[taskId]),
}));
onResultsChange((prevResults) => {
const prevValue = prevResults[taskId];
return {
...prevResults,
[taskId]: getNextValue(typeof prevValue === 'number' ? prevValue : undefined),
};
});
}, [getNextValue, onResultsChange]);

const optionsByValue = useMemo(() => (
Expand Down Expand Up @@ -203,7 +206,7 @@ function CompareMappingSession(props: Props) {
keyExtractor={(task) => task.taskId}
renderItem={({ item: task }) => {
const result = results[task.taskId];
const selectedOption = isDefined(result)
const selectedOption = typeof result === 'number'
? optionsByValue[result]
: undefined;

Expand Down
Loading
Loading