Skip to content

Commit

Permalink
organize
Browse files Browse the repository at this point in the history
  • Loading branch information
liady committed Oct 10, 2024
1 parent 4e96929 commit 809a8ef
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 31 deletions.
10 changes: 5 additions & 5 deletions editor/src/components/editor/action-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1013,6 +1013,11 @@ export interface UpdateProjectRequirements {
requirements: Partial<ProjectRequirements>
}

export interface SetImportWizardOpen {
action: 'SET_IMPORT_WIZARD_OPEN'
open: boolean
}

export interface SetRefreshingDependencies {
action: 'SET_REFRESHING_DEPENDENCIES'
value: boolean
Expand Down Expand Up @@ -1194,11 +1199,6 @@ export interface SetSharingDialogOpen {
open: boolean
}

export interface SetImportWizardOpen {
action: 'SET_IMPORT_WIZARD_OPEN'
open: boolean
}

export interface ResetOnlineState {
action: 'RESET_ONLINE_STATE'
}
Expand Down
18 changes: 9 additions & 9 deletions editor/src/components/editor/store/editor-state.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1520,6 +1520,7 @@ export interface EditorState {
githubOperations: Array<GithubOperation>
importOperations: Array<ImportOperation>
projectRequirements: ProjectRequirements
importWizardOpen: boolean
githubData: GithubData
refreshingDependencies: boolean
colorSwatches: Array<ColorSwatch>
Expand All @@ -1530,7 +1531,6 @@ export interface EditorState {
forking: boolean
collaborators: Collaborator[]
sharingDialogOpen: boolean
importWizardOpen: boolean
editorRemixConfig: EditorRemixConfig
}

Expand Down Expand Up @@ -1605,6 +1605,8 @@ export function editorState(
imageDragSessionState: ImageDragSessionState,
githubOperations: Array<GithubOperation>,
importOperations: Array<ImportOperation>,
importWizardOpen: boolean,
projectRequirements: ProjectRequirements,
branchOriginContents: ProjectContentTreeRoot | null,
githubData: GithubData,
refreshingDependencies: boolean,
Expand All @@ -1616,8 +1618,6 @@ export function editorState(
forking: boolean,
collaborators: Collaborator[],
sharingDialogOpen: boolean,
importWizardOpen: boolean,
projectRequirements: ProjectRequirements,
remixConfig: EditorRemixConfig,
): EditorState {
return {
Expand Down Expand Up @@ -1692,6 +1692,8 @@ export function editorState(
imageDragSessionState: imageDragSessionState,
githubOperations: githubOperations,
importOperations: importOperations,
importWizardOpen: importWizardOpen,
projectRequirements: projectRequirements,
githubData: githubData,
refreshingDependencies: refreshingDependencies,
colorSwatches: colorSwatches,
Expand All @@ -1702,8 +1704,6 @@ export function editorState(
forking: forking,
collaborators: collaborators,
sharingDialogOpen: sharingDialogOpen,
importWizardOpen: importWizardOpen,
projectRequirements: projectRequirements,
editorRemixConfig: remixConfig,
}
}
Expand Down Expand Up @@ -2772,6 +2772,8 @@ export function createEditorState(dispatch: EditorDispatch): EditorState {
imageDragSessionState: notDragging(),
githubOperations: [],
importOperations: [],
importWizardOpen: false,
projectRequirements: emptyProjectRequirements(),
branchOriginContents: null,
githubData: emptyGithubData(),
refreshingDependencies: false,
Expand All @@ -2786,8 +2788,6 @@ export function createEditorState(dispatch: EditorDispatch): EditorState {
forking: false,
collaborators: [],
sharingDialogOpen: false,
importWizardOpen: false,
projectRequirements: emptyProjectRequirements(),
editorRemixConfig: {
errorBoundaryHandling: 'ignore-error-boundaries',
},
Expand Down Expand Up @@ -3142,6 +3142,8 @@ export function editorModelFromPersistentModel(
imageDragSessionState: notDragging(),
githubOperations: [],
importOperations: [],
importWizardOpen: false,
projectRequirements: emptyProjectRequirements(),
refreshingDependencies: false,
branchOriginContents: null,
githubData: emptyGithubData(),
Expand All @@ -3156,8 +3158,6 @@ export function editorModelFromPersistentModel(
forking: false,
collaborators: [],
sharingDialogOpen: false,
importWizardOpen: false,
projectRequirements: emptyProjectRequirements(),
editorRemixConfig: {
errorBoundaryHandling: 'ignore-error-boundaries',
},
Expand Down
34 changes: 17 additions & 17 deletions editor/src/components/editor/store/store-deep-equality-instances.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4784,6 +4784,21 @@ export const ProjectRequirementsKeepDeepEquality: KeepDeepEqualityCall<ProjectRe
newProjectRequirements,
)

export const ImportOperationKeepDeepEquality: KeepDeepEqualityCall<ImportOperation> = (
oldValue,
newValue,
) => {
if (oldValue.type !== newValue.type) {
return keepDeepEqualityResult(newValue, false)
} else if (oldValue.id !== newValue.id) {
return keepDeepEqualityResult(newValue, false)
}
return keepDeepEqualityResult(oldValue, true)
}

export const ImportOperationsKeepDeepEquality: KeepDeepEqualityCall<Array<ImportOperation>> =
arrayDeepEquality(ImportOperationKeepDeepEquality)

export const GithubFileChangesKeepDeepEquality: KeepDeepEqualityCall<GithubFileChanges> =
combine3EqualityCalls(
(settings) => settings.modified,
Expand Down Expand Up @@ -4854,24 +4869,9 @@ export const GithubOperationKeepDeepEquality: KeepDeepEqualityCall<GithubOperati
return keepDeepEqualityResult(oldValue, true)
}

export const ImportOperationKeepDeepEquality: KeepDeepEqualityCall<ImportOperation> = (
oldValue,
newValue,
) => {
if (oldValue.type !== newValue.type) {
return keepDeepEqualityResult(newValue, false)
} else if (oldValue.id !== newValue.id) {
return keepDeepEqualityResult(newValue, false)
}
return keepDeepEqualityResult(oldValue, true)
}

export const GithubOperationsKeepDeepEquality: KeepDeepEqualityCall<Array<GithubOperation>> =
arrayDeepEquality(GithubOperationKeepDeepEquality)

export const ImportOperationsKeepDeepEquality: KeepDeepEqualityCall<Array<ImportOperation>> =
arrayDeepEquality(ImportOperationKeepDeepEquality)

export const ColorSwatchDeepEquality: KeepDeepEqualityCall<ColorSwatch> = combine2EqualityCalls(
(c) => c.id,
StringKeepDeepEquality,
Expand Down Expand Up @@ -5628,6 +5628,8 @@ export const EditorStateKeepDeepEquality: KeepDeepEqualityCall<EditorState> = (
imageDragSessionStateEqual.value,
githubOperationsResults.value,
importOperationsResults.value,
importWizardOpenResults.value,
projectRequirementsResults.value,
branchContentsResults.value,
githubDataResults.value,
refreshingDependenciesResults.value,
Expand All @@ -5639,8 +5641,6 @@ export const EditorStateKeepDeepEquality: KeepDeepEqualityCall<EditorState> = (
forkingResults.value,
collaboratorsResults.value,
sharingDialogOpenResults.value,
importWizardOpenResults.value,
projectRequirementsResults.value,
remixConfigResults.value,
)

Expand Down

0 comments on commit 809a8ef

Please sign in to comment.