-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
panel artboard layers crud with entity fetcher strategies and actions
- Loading branch information
Showing
31 changed files
with
1,012 additions
and
130 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
83 changes: 43 additions & 40 deletions
83
app/components/templates/panel/dashboard-entity-panel.reorder.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,49 +1,52 @@ | ||
import { type designParentTypeIdEnum } from '#app/schema/design' | ||
import { type IEntity, type IEntityParentType } from '#app/schema/entity' | ||
import { | ||
type entityParentIdTypeEnum, | ||
type IEntity, | ||
type IEntityParentType, | ||
} from '#app/schema/entity' | ||
import { type IDashboardPanelUpdateEntityOrderStrategy } from '#app/strategies/component/dashboard-panel/update-entity-move.strategy' | ||
import { SidebarPanelRowReorderContainer } from '..' | ||
import { FormFetcherMoveIcon } from '../form/fetcher/move-icon' | ||
|
||
export const PanelEntityRowReorder = ({ | ||
entity, | ||
parentTypeId, | ||
parent, | ||
entityCount, | ||
entityIndex, | ||
strategyReorder, | ||
entity, | ||
parentTypeId, | ||
parent, | ||
entityCount, | ||
entityIndex, | ||
strategyReorder, | ||
}: { | ||
entity: IEntity | ||
parentTypeId: designParentTypeIdEnum | ||
parent: IEntityParentType | ||
entityCount: number | ||
entityIndex: number | ||
strategyReorder: IDashboardPanelUpdateEntityOrderStrategy | ||
entity: IEntity | ||
parentTypeId: entityParentIdTypeEnum | ||
parent: IEntityParentType | ||
entityCount: number | ||
entityIndex: number | ||
strategyReorder: IDashboardPanelUpdateEntityOrderStrategy | ||
}) => { | ||
const atTop = entityIndex === 0 | ||
const atBottom = entityIndex === entityCount - 1 | ||
const atTop = entityIndex === 0 | ||
const atBottom = entityIndex === entityCount - 1 | ||
|
||
return ( | ||
<SidebarPanelRowReorderContainer> | ||
<FormFetcherMoveIcon | ||
entityId={entity.id} | ||
parentTypeId={parentTypeId} | ||
parentId={parent.id} | ||
route={strategyReorder.route} | ||
formId={strategyReorder.formId} | ||
schema={strategyReorder.schema} | ||
direction="up" | ||
atTopOrBottom={atTop} | ||
/> | ||
<FormFetcherMoveIcon | ||
entityId={entity.id} | ||
parentTypeId={parentTypeId} | ||
parentId={parent.id} | ||
route={strategyReorder.route} | ||
formId={strategyReorder.formId} | ||
schema={strategyReorder.schema} | ||
direction="down" | ||
atTopOrBottom={atBottom} | ||
/> | ||
</SidebarPanelRowReorderContainer> | ||
) | ||
return ( | ||
<SidebarPanelRowReorderContainer> | ||
<FormFetcherMoveIcon | ||
entityId={entity.id} | ||
parentTypeId={parentTypeId} | ||
parentId={parent.id} | ||
route={strategyReorder.route} | ||
formId={strategyReorder.formId} | ||
schema={strategyReorder.schema} | ||
direction="up" | ||
atTopOrBottom={atTop} | ||
/> | ||
<FormFetcherMoveIcon | ||
entityId={entity.id} | ||
parentTypeId={parentTypeId} | ||
parentId={parent.id} | ||
route={strategyReorder.route} | ||
formId={strategyReorder.formId} | ||
schema={strategyReorder.schema} | ||
direction="down" | ||
atTopOrBottom={atBottom} | ||
/> | ||
</SidebarPanelRowReorderContainer> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import { type IntentActionArgs } from '#app/definitions/intent-action-args' | ||
import { DeleteArtboardVersionLayerSchema } from '#app/schema/layer-artboard-version' | ||
import { ValidateArtboardVersionParentSubmissionStrategy } from '#app/strategies/validate-submission.strategy' | ||
import { validateEntitySubmission } from '#app/utils/conform-utils' | ||
import { prisma } from '#app/utils/db.server' | ||
import { type ILayer } from '../layer.server' | ||
|
||
export interface ILayerDeletedResponse { | ||
success: boolean | ||
message?: string | ||
} | ||
|
||
export const validateArtboardVersionDeleteLayerSubmission = async ({ | ||
userId, | ||
formData, | ||
}: IntentActionArgs) => { | ||
const strategy = new ValidateArtboardVersionParentSubmissionStrategy() | ||
|
||
return await validateEntitySubmission({ | ||
userId, | ||
formData, | ||
schema: DeleteArtboardVersionLayerSchema, | ||
strategy, | ||
}) | ||
} | ||
|
||
export const deleteLayer = ({ id }: { id: ILayer['id'] }) => { | ||
return prisma.layer.delete({ | ||
where: { id }, | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.