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
4 changes: 2 additions & 2 deletions app/Base/configs/routes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ const newTutorial = wrap({
path: '/tutorial/new/',
title: 'New Tutorial',
navbarVisibility: true,
component: lazy(() => import('#views/TutorialForm')),
component: lazy(() => import('#views/NewTutorial')),
componentProps: {},
visibility: 'is-authenticated',
});
Expand All @@ -69,7 +69,7 @@ const editTutorial = wrap({
path: '/tutorial/:id/edit/',
title: 'Edit Tutorial',
navbarVisibility: true,
component: lazy(() => import('#views/TutorialForm')),
component: lazy(() => import('#views/EditTutorial')),
componentProps: {},
visibility: 'is-authenticated',
});
Expand Down
4 changes: 2 additions & 2 deletions app/components/GeoJsonAssetMapSource/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { gql } from 'urql';

import GeoJsonMapSource from '#components/GeoJsonMapSource';
import {
ProjectAssetMimetypeEnum,
AssetMimetypeEnum,
useProjectAssetPreviewQuery,
} from '#generated/types/graphql';

Expand Down Expand Up @@ -48,7 +48,7 @@ function GeoJsonAssetMapSource(props: Props) {
async function fetchGeoJson() {
if (isNotDefined(geometryAssetResponse)
|| geometryAssetResponse
.projectAsset.mimetype !== ProjectAssetMimetypeEnum.Geojson
.projectAsset.mimetype !== AssetMimetypeEnum.Geojson
) {
return;
}
Expand Down
12 changes: 6 additions & 6 deletions app/views/EditProject/AssetInput/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { gql } from 'urql';
import FileInput from '#components/FileInput';
import InputContainerLayout, { Props as InputContainerLayoutProps } from '#components/InputContainerLayout';
import {
ProjectAssetMimetypeEnum,
AssetMimetypeEnum,
useCreateProjectAssetMutation,
} from '#generated/types/graphql';
import { OPERATION_INFO_FRAGMENT } from '#utils/query';
Expand Down Expand Up @@ -76,11 +76,11 @@ function AssetInput<const NAME>(props: Props<NAME>) {
const handleFileInputChange = useCallback(async (file: File | undefined) => {
if (file) {
const { type } = file;
const mimetypeEnumMap: Record<string, ProjectAssetMimetypeEnum> = {
'image/jpeg': ProjectAssetMimetypeEnum.ImageJpeg,
'image/png': ProjectAssetMimetypeEnum.ImagePng,
'image/gif': ProjectAssetMimetypeEnum.ImageGif,
'application/geo+json': ProjectAssetMimetypeEnum.Geojson,
const mimetypeEnumMap: Record<string, AssetMimetypeEnum> = {
'image/jpeg': AssetMimetypeEnum.ImageJpeg,
'image/png': AssetMimetypeEnum.ImagePng,
'image/gif': AssetMimetypeEnum.ImageGif,
'application/geo+json': AssetMimetypeEnum.Geojson,
};

const selectedEnum = mimetypeEnumMap[type];
Expand Down
4 changes: 2 additions & 2 deletions app/views/EditProject/ProjectAssetPreview/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { gql } from 'urql';
import GeoJsonPreview from '#components/GeoJsonPreview';
import { PartialRasterTileServerInputFields } from '#components/RasterTileServerInput/schema';
import {
ProjectAssetMimetypeEnum,
AssetMimetypeEnum,
useProjectAssetPreviewQuery,
} from '#generated/types/graphql';

Expand Down Expand Up @@ -63,7 +63,7 @@ function ProjectAssetPreview(props: Props) {
ImagePng,
ImageJpeg,
Geojson,
} = ProjectAssetMimetypeEnum;
} = AssetMimetypeEnum;

useEffect(() => {
async function fetchGeoJson() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,13 @@ import {
PartialForm,
} from '@togglecorp/toggle-form';

import {
TutorialInformationPageBlockCreateInput,
TutorialInformationPageCreateInput,
} from '#generated/types/graphql';
import {
DeepNonNullable,
DeepReplace,
} from '#utils/types';
import { TutorialInformationPageCreateInput } from '#generated/types/graphql';
import { DeepNonNullable } from '#utils/types';

import blockFormSchema, { BlockInputFields } from './BlockInput/schema';
import blockFormSchema from './BlockInput/schema';

export type InformationPagesInputFields = DeepNonNullable<
DeepReplace<
TutorialInformationPageCreateInput & { clientId: string },
TutorialInformationPageBlockCreateInput,
BlockInputFields
>
TutorialInformationPageCreateInput
>;

export type PartialInformationPageInputFields = PartialForm<
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ import {
} from '#generated/types/graphql';
import { DeepNonNullable } from '#utils/types';
import {
type PartialTutorialCreateInputFields,
type PartialTutorialUpdateInputFields,
type TutorialFormContext,
} from '#views/TutorialForm/schema';
} from '#views/EditTutorial/schema';

import comparePropertyInputSchema from './ComparePropertyInput/schema';
import completenessPropertyInputSchema from './CompletenessPropertyInput/schema';
Expand All @@ -24,15 +24,15 @@ export type TaskInputFields = DeepNonNullable<TutorialTaskCreateInput>;
export type PartialTaskInputFields = PartialForm<TaskInputFields, 'clientId'>;
type TaskSchema = ObjectSchema<
PartialTaskInputFields,
PartialTutorialCreateInputFields,
PartialTutorialUpdateInputFields,
TutorialFormContext
>;

type ProjectTypeSpecifics = DeepNonNullable<TutorialTaskProjectTypeSpecificInput>;
export type PartialProjectTypeSpecifics = PartialForm<ProjectTypeSpecifics>;
type ProjectTypeSpecificsSchema = ObjectSchema<
PartialProjectTypeSpecifics,
PartialTutorialCreateInputFields,
PartialTutorialUpdateInputFields,
TutorialFormContext
>;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { TutorialScenarioPageCreateInput } from '#generated/types/graphql';
import { DeepNonNullable } from '#utils/types';

import {
type PartialTutorialCreateInputFields,
type PartialTutorialUpdateInputFields,
type TutorialFormContext,
} from '../schema';
import taskSchema from './TaskInput/schema';
Expand All @@ -23,7 +23,7 @@ export type PartialScenarioPageInputFields = PartialForm<

export type ScenarioPageSchema = ObjectSchema<
PartialScenarioPageInputFields,
PartialTutorialCreateInputFields,
PartialTutorialUpdateInputFields,
TutorialFormContext
>;

Expand Down
Loading