Skip to content

Commit

Permalink
Fix edit extension and publish release (#2505)
Browse files Browse the repository at this point in the history
* fix(): edit extension and release fixes

* chore()
  • Loading branch information
quininez authored Dec 4, 2024
1 parent 13ba21f commit 5d29f47
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,18 @@ import { selectAppData } from '@akashaorg/ui-awf-hooks/lib/selectors/get-apps-by
import { MAX_GALLERY_IMAGES } from '../../../constants';
import { AtomContext, formDefaultData } from './main-page';
import { useAtom } from 'jotai';
import { AppImageSource } from '@akashaorg/typings/lib/sdk/graphql-types-new';

// remove all other props except for src, width and height from an image object
const getImageObject = (imageWithExtraProps: AppImageSource) => {
if (imageWithExtraProps) {
return {
src: imageWithExtraProps.src,
width: imageWithExtraProps.width,
height: imageWithExtraProps.height,
};
} else return null;
};

type EditPublishedExtensionPageProps = {
extensionId: string;
Expand Down Expand Up @@ -72,6 +84,7 @@ export const EditPublishedExtensionPage: React.FC<EditPublishedExtensionPageProp
return {
...prev,
...formData,
dataSavedToForm: true,
};
});
};
Expand All @@ -90,8 +103,8 @@ export const EditPublishedExtensionPage: React.FC<EditPublishedExtensionPageProp

const formDefault = useMemo(() => {
return {
logoImage: defaultValues?.logoImage,
coverImage: defaultValues?.coverImage,
logoImage: getImageObject(defaultValues?.logoImage),
coverImage: getImageObject(defaultValues?.coverImage),
description: defaultValues?.description,
gallery: defaultValues?.gallery,
links: defaultValues?.links,
Expand Down Expand Up @@ -122,7 +135,13 @@ export const EditPublishedExtensionPage: React.FC<EditPublishedExtensionPageProp
logoImage: logoImage || formDefault?.logoImage,
coverImage: coverImage || formDefault?.coverImage,
description: formData?.description,
gallery: formData?.gallery,
gallery: galleryImages?.map(galleryImage => {
return {
width: galleryImage.size?.width,
height: galleryImage.size?.height,
src: galleryImage.src,
};
}),
links: formData?.links,
};
updateAppMutation({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ const ExtensionReleasePublish: React.FC<ExtensionReleasePublishProps> = props =>

return (
<>
<form onSubmit={onSave} className={tw(apply`h-full`)}>
<form className={tw(apply`h-full`)}>
<Stack direction="column" spacing="gap-y-4">
<Stack padding="px-4 pb-16" spacing="gap-y-4">
<Controller
Expand Down Expand Up @@ -192,7 +192,6 @@ const ExtensionReleasePublish: React.FC<ExtensionReleasePublishProps> = props =>
label={nextButton.label}
disabled={!isValid || !isFormDirty}
onClick={showModalFlow ? onConfirmationModalOpen : onSave}
type="submit"
/>
</Stack>
</Stack>
Expand Down

0 comments on commit 5d29f47

Please sign in to comment.