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; | ||||
|   alwaysNewTab?: boolean; | ||||
|   onClick?: MouseEventHandler<HTMLDivElement>; | ||||
|   onMouseUp?: MouseEventHandler<HTMLDivElement>; | ||||
|   draggable?: boolean; | ||||
|   badgeNumber?: number; | ||||
|   disabled?: boolean; | ||||
| @ -33,6 +34,7 @@ export const Button = ({ | ||||
|   draggable, | ||||
|   id, | ||||
|   onClick, | ||||
|   onMouseUp, | ||||
|   active, | ||||
|   className, | ||||
|   icon, | ||||
| @ -52,6 +54,7 @@ export const Button = ({ | ||||
|         draggable={draggable} | ||||
|         id={id} | ||||
|         onClick={onClick} | ||||
|         onMouseUp={onMouseUp} | ||||
|         onFocus={(event) => event.target.blur()} | ||||
|         className={cJoin( | ||||
|           `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} | ||||
|           text={expand ? langui.want_it : undefined} | ||||
|           active={libraryItemUserStatus[id] === LibraryItemUserStatus.Want} | ||||
|           onClick={(event) => { | ||||
|             event.preventDefault(); | ||||
|           onMouseUp={(event) => event.stopPropagation()} | ||||
|           onClick={() => { | ||||
|             setLibraryItemUserStatus((current) => { | ||||
|               const newLibraryItemUserStatus = { ...current }; | ||||
|               newLibraryItemUserStatus[id] = | ||||
| @ -48,8 +48,8 @@ export const PreviewCardCTAs = ({ id, expand = false }: Props): JSX.Element => { | ||||
|           icon={Icon.BackHand} | ||||
|           text={expand ? langui.have_it : undefined} | ||||
|           active={libraryItemUserStatus[id] === LibraryItemUserStatus.Have} | ||||
|           onClick={(event) => { | ||||
|             event.preventDefault(); | ||||
|           onMouseUp={(event) => event.stopPropagation()} | ||||
|           onClick={() => { | ||||
|             setLibraryItemUserStatus((current) => { | ||||
|               const newLibraryItemUserStatus = { ...current }; | ||||
|               newLibraryItemUserStatus[id] = | ||||
|  | ||||
| @ -458,11 +458,9 @@ export const getStaticProps: GetStaticProps = async (context) => { | ||||
| 
 | ||||
|   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) => | ||||
|       a.attributes && b.attributes ? naturalCompare(a.attributes.slug, b.attributes.slug) : 0 | ||||
|     ); | ||||
|   } | ||||
|   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 | ||||
|   ); | ||||
| 
 | ||||
|   const props: Props = { | ||||
|     content: content.contents.data[0].attributes as ContentWithTranslations, | ||||
|  | ||||
| @ -298,6 +298,7 @@ export const getStaticProps: GetStaticProps = async (context) => { | ||||
|     language_code: context.locale ?? "en", | ||||
|   }); | ||||
|   if (!contents.contents) return { notFound: true }; | ||||
|    | ||||
|   contents.contents.data.sort((a, b) => { | ||||
|     const titleA = a.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 subFolders = { | ||||
|     // eslint-disable-next-line id-denylist
 | ||||
|     data: filterHasAttributes(folder.subfolders?.data, ["attributes.slug"]).sort((a, b) => | ||||
|       naturalCompare(a.attributes.slug, b.attributes.slug) | ||||
|     ), | ||||
|   }; | ||||
|   folder.subfolders?.data.sort((a, b) => | ||||
|     a.attributes && b.attributes ? naturalCompare(a.attributes.slug, b.attributes.slug) : 0 | ||||
|   ); | ||||
| 
 | ||||
|   const contents = { | ||||
|     // eslint-disable-next-line id-denylist
 | ||||
|     data: filterHasAttributes(folder.contents?.data, ["attributes.slug"]).sort((a, b) => | ||||
|       naturalCompare(a.attributes.slug, b.attributes.slug) | ||||
|     ), | ||||
|   }; | ||||
| 
 | ||||
|   folder.contents = contents; | ||||
|   folder.subfolders = subFolders; | ||||
|   folder.contents?.data.sort((a, b) => | ||||
|     a.attributes && b.attributes ? naturalCompare(a.attributes.slug, b.attributes.slug) : 0 | ||||
|   ); | ||||
| 
 | ||||
|   const title = (() => { | ||||
|     if (slug === "root") { | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 DrMint
						DrMint