Fixed unabled to click on the preview ctas
This commit is contained in:
parent
5fc1d26243
commit
7b303f81ad
|
@ -21,6 +21,7 @@ interface Props {
|
||||||
text?: string | null | undefined;
|
text?: string | null | undefined;
|
||||||
alwaysNewTab?: boolean;
|
alwaysNewTab?: boolean;
|
||||||
onClick?: MouseEventHandler<HTMLDivElement>;
|
onClick?: MouseEventHandler<HTMLDivElement>;
|
||||||
|
onMouseUp?: MouseEventHandler<HTMLDivElement>;
|
||||||
draggable?: boolean;
|
draggable?: boolean;
|
||||||
badgeNumber?: number;
|
badgeNumber?: number;
|
||||||
disabled?: boolean;
|
disabled?: boolean;
|
||||||
|
@ -33,6 +34,7 @@ export const Button = ({
|
||||||
draggable,
|
draggable,
|
||||||
id,
|
id,
|
||||||
onClick,
|
onClick,
|
||||||
|
onMouseUp,
|
||||||
active,
|
active,
|
||||||
className,
|
className,
|
||||||
icon,
|
icon,
|
||||||
|
@ -52,6 +54,7 @@ export const Button = ({
|
||||||
draggable={draggable}
|
draggable={draggable}
|
||||||
id={id}
|
id={id}
|
||||||
onClick={onClick}
|
onClick={onClick}
|
||||||
|
onMouseUp={onMouseUp}
|
||||||
onFocus={(event) => event.target.blur()}
|
onFocus={(event) => event.target.blur()}
|
||||||
className={cJoin(
|
className={cJoin(
|
||||||
`group grid cursor-pointer select-none grid-flow-col place-content-center
|
`group grid cursor-pointer select-none grid-flow-col place-content-center
|
||||||
|
|
|
@ -30,8 +30,8 @@ export const PreviewCardCTAs = ({ id, expand = false }: Props): JSX.Element => {
|
||||||
icon={Icon.Favorite}
|
icon={Icon.Favorite}
|
||||||
text={expand ? langui.want_it : undefined}
|
text={expand ? langui.want_it : undefined}
|
||||||
active={libraryItemUserStatus[id] === LibraryItemUserStatus.Want}
|
active={libraryItemUserStatus[id] === LibraryItemUserStatus.Want}
|
||||||
onClick={(event) => {
|
onMouseUp={(event) => event.stopPropagation()}
|
||||||
event.preventDefault();
|
onClick={() => {
|
||||||
setLibraryItemUserStatus((current) => {
|
setLibraryItemUserStatus((current) => {
|
||||||
const newLibraryItemUserStatus = { ...current };
|
const newLibraryItemUserStatus = { ...current };
|
||||||
newLibraryItemUserStatus[id] =
|
newLibraryItemUserStatus[id] =
|
||||||
|
@ -48,8 +48,8 @@ export const PreviewCardCTAs = ({ id, expand = false }: Props): JSX.Element => {
|
||||||
icon={Icon.BackHand}
|
icon={Icon.BackHand}
|
||||||
text={expand ? langui.have_it : undefined}
|
text={expand ? langui.have_it : undefined}
|
||||||
active={libraryItemUserStatus[id] === LibraryItemUserStatus.Have}
|
active={libraryItemUserStatus[id] === LibraryItemUserStatus.Have}
|
||||||
onClick={(event) => {
|
onMouseUp={(event) => event.stopPropagation()}
|
||||||
event.preventDefault();
|
onClick={() => {
|
||||||
setLibraryItemUserStatus((current) => {
|
setLibraryItemUserStatus((current) => {
|
||||||
const newLibraryItemUserStatus = { ...current };
|
const newLibraryItemUserStatus = { ...current };
|
||||||
newLibraryItemUserStatus[id] =
|
newLibraryItemUserStatus[id] =
|
||||||
|
|
|
@ -458,11 +458,9 @@ export const getStaticProps: GetStaticProps = async (context) => {
|
||||||
|
|
||||||
const thumbnail = content.contents.data[0].attributes.thumbnail?.data?.attributes;
|
const thumbnail = content.contents.data[0].attributes.thumbnail?.data?.attributes;
|
||||||
|
|
||||||
if (content.contents.data[0].attributes.folder?.data?.attributes?.contents?.data) {
|
content.contents.data[0].attributes.folder?.data?.attributes?.contents?.data.sort((a, b) =>
|
||||||
content.contents.data[0].attributes.folder.data.attributes.contents.data.sort((a, b) =>
|
|
||||||
a.attributes && b.attributes ? naturalCompare(a.attributes.slug, b.attributes.slug) : 0
|
a.attributes && b.attributes ? naturalCompare(a.attributes.slug, b.attributes.slug) : 0
|
||||||
);
|
);
|
||||||
}
|
|
||||||
|
|
||||||
const props: Props = {
|
const props: Props = {
|
||||||
content: content.contents.data[0].attributes as ContentWithTranslations,
|
content: content.contents.data[0].attributes as ContentWithTranslations,
|
||||||
|
|
|
@ -298,6 +298,7 @@ export const getStaticProps: GetStaticProps = async (context) => {
|
||||||
language_code: context.locale ?? "en",
|
language_code: context.locale ?? "en",
|
||||||
});
|
});
|
||||||
if (!contents.contents) return { notFound: true };
|
if (!contents.contents) return { notFound: true };
|
||||||
|
|
||||||
contents.contents.data.sort((a, b) => {
|
contents.contents.data.sort((a, b) => {
|
||||||
const titleA = a.attributes?.slug ?? "";
|
const titleA = a.attributes?.slug ?? "";
|
||||||
const titleB = b.attributes?.slug ?? "";
|
const titleB = b.attributes?.slug ?? "";
|
||||||
|
|
|
@ -215,22 +215,13 @@ export const getStaticProps: GetStaticProps = async (context) => {
|
||||||
|
|
||||||
const folder = contentsFolder.contentsFolders.data[0].attributes;
|
const folder = contentsFolder.contentsFolders.data[0].attributes;
|
||||||
|
|
||||||
const subFolders = {
|
folder.subfolders?.data.sort((a, b) =>
|
||||||
// eslint-disable-next-line id-denylist
|
a.attributes && b.attributes ? naturalCompare(a.attributes.slug, b.attributes.slug) : 0
|
||||||
data: filterHasAttributes(folder.subfolders?.data, ["attributes.slug"]).sort((a, b) =>
|
);
|
||||||
naturalCompare(a.attributes.slug, b.attributes.slug)
|
|
||||||
),
|
|
||||||
};
|
|
||||||
|
|
||||||
const contents = {
|
folder.contents?.data.sort((a, b) =>
|
||||||
// eslint-disable-next-line id-denylist
|
a.attributes && b.attributes ? naturalCompare(a.attributes.slug, b.attributes.slug) : 0
|
||||||
data: filterHasAttributes(folder.contents?.data, ["attributes.slug"]).sort((a, b) =>
|
);
|
||||||
naturalCompare(a.attributes.slug, b.attributes.slug)
|
|
||||||
),
|
|
||||||
};
|
|
||||||
|
|
||||||
folder.contents = contents;
|
|
||||||
folder.subfolders = subFolders;
|
|
||||||
|
|
||||||
const title = (() => {
|
const title = (() => {
|
||||||
if (slug === "root") {
|
if (slug === "root") {
|
||||||
|
|
Loading…
Reference in New Issue