Fixed a few things
This commit is contained in:
		
							parent
							
								
									9a3d76a356
								
							
						
					
					
						commit
						89f4168e72
					
				| @ -52,7 +52,7 @@ export const Button = ({ | ||||
|       <div | ||||
|         className="relative" | ||||
|         onClick={() => { | ||||
|           if (isDefined(href) || isDefined(locale)) { | ||||
|           if (!isDefined(target) && (isDefined(href) || isDefined(locale))) { | ||||
|             router.push(href ?? router.asPath, href, { | ||||
|               locale: locale, | ||||
|             }); | ||||
|  | ||||
| @ -199,8 +199,8 @@ export const Markdawn = ({ | ||||
|             Line: { | ||||
|               component: (compProps) => ( | ||||
|                 <> | ||||
|                   <strong className="text-dark opacity-60 mobile:!-mb-4"> | ||||
|                     {compProps.name} | ||||
|                   <strong className="text-dark/60 mobile:!-mb-4 !my-0"> | ||||
|                     <Markdawn text={compProps.name} /> | ||||
|                   </strong> | ||||
|                   <p className="whitespace-pre-line">{compProps.children}</p> | ||||
|                 </> | ||||
| @ -427,11 +427,17 @@ enum HeaderLevels { | ||||
| const preprocessMarkDawn = (text: string, playerName = ""): string => { | ||||
|   if (!text) return ""; | ||||
| 
 | ||||
|   const processedPlayerName = playerName | ||||
|     .replaceAll("_", "\\_") | ||||
|     .replaceAll("*", "\\*"); | ||||
| 
 | ||||
|   let preprocessed = text | ||||
|     .replaceAll("--", "—") | ||||
|     .replaceAll( | ||||
|       "@player", | ||||
|       isDefinedAndNotEmpty(playerName) ? playerName : "(player)" | ||||
|       isDefinedAndNotEmpty(processedPlayerName) | ||||
|         ? processedPlayerName | ||||
|         : "(player)" | ||||
|     ); | ||||
| 
 | ||||
|   console.log(); | ||||
|  | ||||
| @ -39,7 +39,7 @@ export const PreviewLine = ({ | ||||
|     > | ||||
|       {thumbnail ? ( | ||||
|         <div className="aspect-[3/2] h-full"> | ||||
|           <Img image={thumbnail} quality={ImageQuality.Medium} /> | ||||
|           <Img className="h-full object-cover" image={thumbnail} quality={ImageQuality.Medium} /> | ||||
|         </div> | ||||
|       ) : ( | ||||
|         <div style={{ aspectRatio: thumbnailAspectRatio }}></div> | ||||
|  | ||||
| @ -24,6 +24,9 @@ query devGetContents { | ||||
|           language { | ||||
|             data { | ||||
|               id | ||||
|               attributes { | ||||
|                 code | ||||
|               } | ||||
|             } | ||||
|           } | ||||
|           title | ||||
| @ -32,6 +35,9 @@ query devGetContents { | ||||
|             source_language { | ||||
|               data { | ||||
|                 id | ||||
|                 attributes { | ||||
|                   code | ||||
|                 } | ||||
|               } | ||||
|             } | ||||
|             status | ||||
|  | ||||
							
								
								
									
										23
									
								
								src/helpers/types/Report.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										23
									
								
								src/helpers/types/Report.ts
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,23 @@ | ||||
| export type Report = { | ||||
|   title: string; | ||||
|   lines: ReportLine[]; | ||||
| }; | ||||
| 
 | ||||
| export type ReportLine = { | ||||
|   subitems: string[]; | ||||
|   name: string; | ||||
|   type: "Error" | "Improvement" | "Missing"; | ||||
|   severity: Severity; | ||||
|   description: string; | ||||
|   recommandation: string; | ||||
|   backendUrl: string; | ||||
|   frontendUrl: string; | ||||
| }; | ||||
| 
 | ||||
| export enum Severity { | ||||
|   VeryLow = 0, | ||||
|   Low = 1, | ||||
|   Medium = 2, | ||||
|   High = 3, | ||||
|   VeryHigh = 4, | ||||
| } | ||||
| @ -271,7 +271,7 @@ const Contents = ({ | ||||
|               keepInfoVisible={keepInfoVisible} | ||||
|             /> | ||||
|           )} | ||||
|           className="grid-cols-2 items-end desktop:grid-cols-[repeat(auto-fill,_minmax(15rem,1fr))]" | ||||
|           className="grid-cols-2 desktop:grid-cols-[repeat(auto-fill,_minmax(15rem,1fr))]" | ||||
|           groupingFunction={groupingFunction} | ||||
|           filteringFunction={filteringFunction} | ||||
|           searchingTerm={searchName} | ||||
|  | ||||
| @ -12,6 +12,7 @@ import { DevGetContentsQuery } from "graphql/generated"; | ||||
| import { AppStaticProps, getAppStaticProps } from "graphql/getAppStaticProps"; | ||||
| import { getReadySdk } from "graphql/sdk"; | ||||
| import { filterDefined, filterHasAttributes } from "helpers/others"; | ||||
| import { Report, Severity } from "helpers/types/Report"; | ||||
| 
 | ||||
| /* | ||||
|  *                                           ╭────────╮ | ||||
| @ -23,7 +24,7 @@ interface Props extends AppStaticProps { | ||||
| } | ||||
| 
 | ||||
| const CheckupContents = ({ contents, ...otherProps }: Props): JSX.Element => { | ||||
|   const testReport = testingContent(contents); | ||||
|   const testReport = useMemo(() => testingContent(contents), [contents]); | ||||
| 
 | ||||
|   const contentPanel = useMemo( | ||||
|     () => ( | ||||
| @ -40,44 +41,47 @@ const CheckupContents = ({ contents, ...otherProps }: Props): JSX.Element => { | ||||
|           <p className="font-headers">Description</p> | ||||
|         </div> | ||||
| 
 | ||||
|         {testReport.lines.map((line, index) => ( | ||||
|           <div | ||||
|             key={index} | ||||
|             className="mb-2 grid grid-cols-[2em,3em,2fr,1fr,0.5fr,0.5fr,2fr] items-center | ||||
|         {testReport.lines | ||||
|           .sort((a, b) => a.name.localeCompare(b.name)) | ||||
|           .sort((a, b) => b.severity - a.severity) | ||||
|           .map((line, index) => ( | ||||
|             <div | ||||
|               key={index} | ||||
|               className="mb-2 grid grid-cols-[2em,3em,2fr,1fr,0.5fr,0.5fr,2fr] items-center | ||||
|           justify-items-start gap-2" | ||||
|           > | ||||
|             <Button | ||||
|               href={line.frontendUrl} | ||||
|               target="_blank" | ||||
|               className="w-4 text-xs" | ||||
|               text="F" | ||||
|             /> | ||||
|             <Button | ||||
|               href={line.backendUrl} | ||||
|               target="_blank" | ||||
|               className="w-4 text-xs" | ||||
|               text="B" | ||||
|             /> | ||||
|             <p>{line.subitems.join(" -> ")}</p> | ||||
|             <p>{line.name}</p> | ||||
|             <Chip text={line.type} /> | ||||
|             <Chip | ||||
|               className={ | ||||
|                 line.severity === "Very High" | ||||
|                   ? "bg-[#f00] font-bold !opacity-100" | ||||
|                   : line.severity === "High" | ||||
|                   ? "bg-[#ff6600] font-bold !opacity-100" | ||||
|                   : line.severity === "Medium" | ||||
|                   ? "bg-[#fff344] !opacity-100" | ||||
|                   : "" | ||||
|               } | ||||
|               text={line.severity} | ||||
|             /> | ||||
|             <ToolTip content={line.recommandation} placement="left"> | ||||
|               <p>{line.description}</p> | ||||
|             </ToolTip> | ||||
|           </div> | ||||
|         ))} | ||||
|             > | ||||
|               <Button | ||||
|                 href={line.frontendUrl} | ||||
|                 target="_blank" | ||||
|                 className="w-4 text-xs" | ||||
|                 text="F" | ||||
|               /> | ||||
|               <Button | ||||
|                 href={line.backendUrl} | ||||
|                 target="_blank" | ||||
|                 className="w-4 text-xs" | ||||
|                 text="B" | ||||
|               /> | ||||
|               <p>{line.subitems.join(" -> ")}</p> | ||||
|               <p>{line.name}</p> | ||||
|               <Chip text={line.type} /> | ||||
|               <Chip | ||||
|                 className={ | ||||
|                   line.severity === Severity.VeryHigh | ||||
|                     ? "bg-[#f00] font-bold !opacity-100" | ||||
|                     : line.severity === Severity.High | ||||
|                     ? "bg-[#ff6600] font-bold !opacity-100" | ||||
|                     : line.severity === Severity.Medium | ||||
|                     ? "bg-[#fff344] !opacity-100" | ||||
|                     : "" | ||||
|                 } | ||||
|                 text={Severity[line.severity]} | ||||
|               /> | ||||
|               <ToolTip content={line.recommandation} placement="left"> | ||||
|                 <p>{line.description}</p> | ||||
|               </ToolTip> | ||||
|             </div> | ||||
|           ))} | ||||
|       </ContentPanel> | ||||
|     ), | ||||
|     [testReport.lines, testReport.title] | ||||
| @ -115,22 +119,6 @@ export const getStaticProps: GetStaticProps = async (context) => { | ||||
|  * ─────────────────────────────────────╯  PRIVATE METHODS  ╰─────────────────────────────────────── | ||||
|  */ | ||||
| 
 | ||||
| type Report = { | ||||
|   title: string; | ||||
|   lines: ReportLine[]; | ||||
| }; | ||||
| 
 | ||||
| type ReportLine = { | ||||
|   subitems: string[]; | ||||
|   name: string; | ||||
|   type: "Error" | "Improvement" | "Missing"; | ||||
|   severity: "High" | "Low" | "Medium" | "Very High" | "Very Low"; | ||||
|   description: string; | ||||
|   recommandation: string; | ||||
|   backendUrl: string; | ||||
|   frontendUrl: string; | ||||
| }; | ||||
| 
 | ||||
| const testingContent = (contents: Props["contents"]): Report => { | ||||
|   const report: Report = { | ||||
|     title: "Contents", | ||||
| @ -147,7 +135,7 @@ const testingContent = (contents: Props["contents"]): Report => { | ||||
|           subitems: [content.attributes.slug], | ||||
|           name: "No Category", | ||||
|           type: "Missing", | ||||
|           severity: "Medium", | ||||
|           severity: Severity.High, | ||||
|           description: "The Content has no Category.", | ||||
|           recommandation: "Select a Category in relation with the Content", | ||||
|           backendUrl: backendUrl, | ||||
| @ -158,9 +146,9 @@ const testingContent = (contents: Props["contents"]): Report => { | ||||
|       if (!content.attributes.type?.data?.id) { | ||||
|         report.lines.push({ | ||||
|           subitems: [content.attributes.slug], | ||||
|           name: "No Category", | ||||
|           name: "No Type", | ||||
|           type: "Missing", | ||||
|           severity: "Medium", | ||||
|           severity: Severity.High, | ||||
|           description: "The Content has no Type.", | ||||
|           recommandation: 'If unsure, use the "Other" Type.', | ||||
|           backendUrl: backendUrl, | ||||
| @ -173,7 +161,7 @@ const testingContent = (contents: Props["contents"]): Report => { | ||||
|           subitems: [content.attributes.slug], | ||||
|           name: "No Ranged Content", | ||||
|           type: "Improvement", | ||||
|           severity: "Low", | ||||
|           severity: Severity.Low, | ||||
|           description: "The Content has no Ranged Content.", | ||||
|           recommandation: | ||||
|             "If this Content is available in one or multiple Library Item(s), create a Range Content to connect the Content to its Library Item(s).", | ||||
| @ -187,7 +175,7 @@ const testingContent = (contents: Props["contents"]): Report => { | ||||
|           subitems: [content.attributes.slug], | ||||
|           name: "No Thumbnail", | ||||
|           type: "Missing", | ||||
|           severity: "High", | ||||
|           severity: Severity.High, | ||||
|           description: "The Content has no Thumbnail.", | ||||
|           recommandation: "", | ||||
|           backendUrl: backendUrl, | ||||
| @ -200,7 +188,7 @@ const testingContent = (contents: Props["contents"]): Report => { | ||||
|           subitems: [content.attributes.slug], | ||||
|           name: "No Titles", | ||||
|           type: "Missing", | ||||
|           severity: "High", | ||||
|           severity: Severity.High, | ||||
|           description: "The Content has no Titles.", | ||||
|           recommandation: "", | ||||
|           backendUrl: backendUrl, | ||||
| @ -209,248 +197,90 @@ const testingContent = (contents: Props["contents"]): Report => { | ||||
|       } else { | ||||
|         const titleLanguages: string[] = []; | ||||
| 
 | ||||
|         filterDefined(content.attributes.translations).map( | ||||
|           (translation, titleIndex) => { | ||||
|             if (translation.language?.data?.id) { | ||||
|               if (translation.language.data.id in titleLanguages) { | ||||
|         if ( | ||||
|           content.attributes.translations && | ||||
|           content.attributes.translations.length > 0 | ||||
|         ) { | ||||
|           filterDefined(content.attributes.translations).map( | ||||
|             (translation, titleIndex) => { | ||||
|               if (translation.language?.data?.id) { | ||||
|                 if (translation.language.data.id in titleLanguages) { | ||||
|                   report.lines.push({ | ||||
|                     subitems: [ | ||||
|                       content.attributes.slug, | ||||
|                       `Title ${titleIndex.toString()}`, | ||||
|                     ], | ||||
|                     name: "Duplicate Language", | ||||
|                     type: "Error", | ||||
|                     severity: Severity.High, | ||||
|                     description: "", | ||||
|                     recommandation: "", | ||||
|                     backendUrl: backendUrl, | ||||
|                     frontendUrl: frontendUrl, | ||||
|                   }); | ||||
|                 } else { | ||||
|                   titleLanguages.push(translation.language.data.id); | ||||
|                 } | ||||
|               } else { | ||||
|                 report.lines.push({ | ||||
|                   subitems: [ | ||||
|                     content.attributes.slug, | ||||
|                     `Title ${titleIndex.toString()}`, | ||||
|                   ], | ||||
|                   name: "Duplicate Language", | ||||
|                   name: "No Language", | ||||
|                   type: "Error", | ||||
|                   severity: "High", | ||||
|                   severity: Severity.VeryHigh, | ||||
|                   description: "", | ||||
|                   recommandation: "", | ||||
|                   backendUrl: backendUrl, | ||||
|                   frontendUrl: frontendUrl, | ||||
|                 }); | ||||
|               } | ||||
|               if (!translation.description) { | ||||
|                 report.lines.push({ | ||||
|                   subitems: [ | ||||
|                     content.attributes.slug, | ||||
|                     `Title ${titleIndex.toString()}`, | ||||
|                   ], | ||||
|                   name: "No Description", | ||||
|                   type: "Missing", | ||||
|                   severity: Severity.Medium, | ||||
|                   description: "", | ||||
|                   recommandation: "", | ||||
|                   backendUrl: backendUrl, | ||||
|                   frontendUrl: frontendUrl, | ||||
|                 }); | ||||
|               } else { | ||||
|                 titleLanguages.push(translation.language.data.id); | ||||
|               } | ||||
|             } else { | ||||
|               report.lines.push({ | ||||
|                 subitems: [ | ||||
|                   content.attributes.slug, | ||||
|                   `Title ${titleIndex.toString()}`, | ||||
|                 ], | ||||
|                 name: "No Language", | ||||
|                 type: "Error", | ||||
|                 severity: "Very High", | ||||
|                 description: "", | ||||
|                 recommandation: "", | ||||
|                 backendUrl: backendUrl, | ||||
|                 frontendUrl: frontendUrl, | ||||
|               }); | ||||
|             } | ||||
|             if (!translation.description) { | ||||
|               report.lines.push({ | ||||
|                 subitems: [ | ||||
|                   content.attributes.slug, | ||||
|                   `Title ${titleIndex.toString()}`, | ||||
|                 ], | ||||
|                 name: "No Description", | ||||
|                 type: "Missing", | ||||
|                 severity: "Medium", | ||||
|                 description: "", | ||||
|                 recommandation: "", | ||||
|                 backendUrl: backendUrl, | ||||
|                 frontendUrl: frontendUrl, | ||||
|               }); | ||||
|             } | ||||
| 
 | ||||
|             if (translation.text_set) { | ||||
|               report.lines.push({ | ||||
|                 subitems: [content.attributes.slug], | ||||
|                 name: "No Text Set", | ||||
|                 type: "Missing", | ||||
|                 severity: "Medium", | ||||
|                 description: "The Content has no Text Set.", | ||||
|                 recommandation: "", | ||||
|                 backendUrl: backendUrl, | ||||
|                 frontendUrl: frontendUrl, | ||||
|               }); | ||||
|             } else { | ||||
|               /* | ||||
|                *const textSetLanguages: string[] = []; | ||||
|                *if (content.attributes && textSet) { | ||||
|                *  if (textSet.language?.data?.id) { | ||||
|                *    if (textSet.language.data.id in textSetLanguages) { | ||||
|                *      report.lines.push({ | ||||
|                *        subitems: [ | ||||
|                *          content.attributes.slug, | ||||
|                *          `TextSet ${textSetIndex.toString()}`, | ||||
|                *        ], | ||||
|                *        name: "Duplicate Language", | ||||
|                *        type: "Error", | ||||
|                *        severity: "High", | ||||
|                *        description: "", | ||||
|                *        recommandation: "", | ||||
|                *        backendUrl: backendUrl, | ||||
|                *        frontendUrl: frontendUrl, | ||||
|                *      }); | ||||
|                *    } else { | ||||
|                *      textSetLanguages.push(textSet.language.data.id); | ||||
|                *    } | ||||
|                *  } else { | ||||
|                *    report.lines.push({ | ||||
|                *      subitems: [ | ||||
|                *        content.attributes.slug, | ||||
|                *        `TextSet ${textSetIndex.toString()}`, | ||||
|                *      ], | ||||
|                *      name: "No Language", | ||||
|                *      type: "Error", | ||||
|                *      severity: "Very High", | ||||
|                *      description: "", | ||||
|                *      recommandation: "", | ||||
|                *      backendUrl: backendUrl, | ||||
|                *      frontendUrl: frontendUrl, | ||||
|                *    }); | ||||
|                *  } | ||||
|                * | ||||
|                *  if (!textSet.source_language?.data?.id) { | ||||
|                *    report.lines.push({ | ||||
|                *      subitems: [ | ||||
|                *        content.attributes.slug, | ||||
|                *        `TextSet ${textSetIndex.toString()}`, | ||||
|                *      ], | ||||
|                *      name: "No Source Language", | ||||
|                *      type: "Error", | ||||
|                *      severity: "High", | ||||
|                *      description: "", | ||||
|                *      recommandation: "", | ||||
|                *      backendUrl: backendUrl, | ||||
|                *      frontendUrl: frontendUrl, | ||||
|                *    }); | ||||
|                *  } | ||||
|                * | ||||
|                *  if (textSet.status !== Enum_Componentsetstextset_Status.Done) { | ||||
|                *    report.lines.push({ | ||||
|                *      subitems: [ | ||||
|                *        content.attributes.slug, | ||||
|                *        `TextSet ${textSetIndex.toString()}`, | ||||
|                *      ], | ||||
|                *      name: "Not Done Status", | ||||
|                *      type: "Improvement", | ||||
|                *      severity: "Low", | ||||
|                *      description: "", | ||||
|                *      recommandation: "", | ||||
|                *      backendUrl: backendUrl, | ||||
|                *      frontendUrl: frontendUrl, | ||||
|                *    }); | ||||
|                *  } | ||||
|                * | ||||
|                *  if (!textSet.text || textSet.text.length < 10) { | ||||
|                *    report.lines.push({ | ||||
|                *      subitems: [ | ||||
|                *        content.attributes.slug, | ||||
|                *        `TextSet ${textSetIndex.toString()}`, | ||||
|                *      ], | ||||
|                *      name: "No Text", | ||||
|                *      type: "Missing", | ||||
|                *      severity: "Medium", | ||||
|                *      description: "", | ||||
|                *      recommandation: "", | ||||
|                *      backendUrl: backendUrl, | ||||
|                *      frontendUrl: frontendUrl, | ||||
|                *    }); | ||||
|                *  } | ||||
|                * | ||||
|                *  if ( | ||||
|                *    textSet.source_language?.data?.id === | ||||
|                *    textSet.language?.data?.id | ||||
|                *  ) { | ||||
|                *    if (textSet.transcribers?.data.length === 0) { | ||||
|                *      report.lines.push({ | ||||
|                *        subitems: [ | ||||
|                *          content.attributes.slug, | ||||
|                *          `TextSet ${textSetIndex.toString()}`, | ||||
|                *        ], | ||||
|                *        name: "No Transcribers", | ||||
|                *        type: "Missing", | ||||
|                *        severity: "High", | ||||
|                *        description: | ||||
|                *          "The Content is a Transcription but doesn't credit any Transcribers.", | ||||
|                *        recommandation: "Add the appropriate Transcribers.", | ||||
|                *        backendUrl: backendUrl, | ||||
|                *        frontendUrl: frontendUrl, | ||||
|                *      }); | ||||
|                *    } | ||||
|                *    if ( | ||||
|                *      textSet.translators?.data && | ||||
|                *      textSet.translators.data.length > 0 | ||||
|                *    ) { | ||||
|                *      report.lines.push({ | ||||
|                *        subitems: [ | ||||
|                *          content.attributes.slug, | ||||
|                *          `TextSet ${textSetIndex.toString()}`, | ||||
|                *        ], | ||||
|                *        name: "Credited Translators", | ||||
|                *        type: "Error", | ||||
|                *        severity: "High", | ||||
|                *        description: | ||||
|                *          "The Content is a Transcription but credits one or more Translators.", | ||||
|                *        recommandation: | ||||
|                *          "If appropriate, create a Translation Text Set with the Translator credited there.", | ||||
|                *        backendUrl: backendUrl, | ||||
|                *        frontendUrl: frontendUrl, | ||||
|                *      }); | ||||
|                *    } | ||||
|                *  } else { | ||||
|                *    if (textSet.translators?.data.length === 0) { | ||||
|                *      report.lines.push({ | ||||
|                *        subitems: [ | ||||
|                *          content.attributes.slug, | ||||
|                *          `TextSet ${textSetIndex.toString()}`, | ||||
|                *        ], | ||||
|                *        name: "No Translators", | ||||
|                *        type: "Missing", | ||||
|                *        severity: "High", | ||||
|                *        description: | ||||
|                *          "The Content is a Transcription but doesn't credit any Translators.", | ||||
|                *        recommandation: "Add the appropriate Translators.", | ||||
|                *        backendUrl: backendUrl, | ||||
|                *        frontendUrl: frontendUrl, | ||||
|                *      }); | ||||
|                *    } | ||||
|                *    if ( | ||||
|                *      textSet.transcribers?.data && | ||||
|                *      textSet.transcribers.data.length > 0 | ||||
|                *    ) { | ||||
|                *      report.lines.push({ | ||||
|                *        subitems: [ | ||||
|                *          content.attributes.slug, | ||||
|                *          `TextSet ${textSetIndex.toString()}`, | ||||
|                *        ], | ||||
|                *        name: "Credited Transcribers", | ||||
|                *        type: "Error", | ||||
|                *        severity: "High", | ||||
|                *        description: | ||||
|                *          "The Content is a Translation but credits one or more Transcribers.", | ||||
|                *        recommandation: | ||||
|                *          "If appropriate, create a Transcription Text Set with the Transcribers credited there.", | ||||
|                *        backendUrl: backendUrl, | ||||
|                *        frontendUrl: frontendUrl, | ||||
|                *      }); | ||||
|                *    } | ||||
|                *  } | ||||
|                *} | ||||
|                */ | ||||
|               if (!translation.text_set) { | ||||
|                 report.lines.push({ | ||||
|                   subitems: [ | ||||
|                     content.attributes.slug, | ||||
|                     translation.language?.data?.attributes?.code ?? "", | ||||
|                   ], | ||||
|                   name: "No Text Set", | ||||
|                   type: "Missing", | ||||
|                   severity: Severity.High, | ||||
|                   description: "The Content has no Text Set.", | ||||
|                   recommandation: "", | ||||
|                   backendUrl: backendUrl, | ||||
|                   frontendUrl: frontendUrl, | ||||
|                 }); | ||||
|               } | ||||
|             } | ||||
| 
 | ||||
|             report.lines.push({ | ||||
|               subitems: [content.attributes.slug], | ||||
|               name: "No Sets", | ||||
|               type: "Missing", | ||||
|               severity: "Medium", | ||||
|               description: "The Content has no Sets.", | ||||
|               recommandation: "", | ||||
|               backendUrl: backendUrl, | ||||
|               frontendUrl: frontendUrl, | ||||
|             }); | ||||
|           } | ||||
|         ); | ||||
|           ); | ||||
|         } else { | ||||
|           report.lines.push({ | ||||
|             subitems: [content.attributes.slug], | ||||
|             name: "No Translations", | ||||
|             type: "Missing", | ||||
|             severity: Severity.High, | ||||
|             description: "The Content has no Translations.", | ||||
|             recommandation: "", | ||||
|             backendUrl: backendUrl, | ||||
|             frontendUrl: frontendUrl, | ||||
|           }); | ||||
|         } | ||||
|       } | ||||
|     } | ||||
|   ); | ||||
|  | ||||
| @ -14,6 +14,7 @@ import { | ||||
| } from "graphql/generated"; | ||||
| import { AppStaticProps, getAppStaticProps } from "graphql/getAppStaticProps"; | ||||
| import { getReadySdk } from "graphql/sdk"; | ||||
| import { Report, Severity } from "helpers/types/Report"; | ||||
| 
 | ||||
| /* | ||||
|  *                                           ╭────────╮ | ||||
| @ -45,44 +46,47 @@ const CheckupLibraryItems = ({ | ||||
|           <p className="font-headers">Description</p> | ||||
|         </div> | ||||
| 
 | ||||
|         {testReport.lines.map((line, index) => ( | ||||
|           <div | ||||
|             key={index} | ||||
|             className="mb-2 grid | ||||
|         {testReport.lines | ||||
|           .sort((a, b) => a.name.localeCompare(b.name)) | ||||
|           .sort((a, b) => b.severity - a.severity) | ||||
|           .map((line, index) => ( | ||||
|             <div | ||||
|               key={index} | ||||
|               className="mb-2 grid | ||||
|           grid-cols-[2em,3em,2fr,1fr,0.5fr,0.5fr,2fr] items-center justify-items-start gap-2" | ||||
|           > | ||||
|             <Button | ||||
|               href={line.frontendUrl} | ||||
|               target="_blank" | ||||
|               className="w-4 text-xs" | ||||
|               text="F" | ||||
|             /> | ||||
|             <Button | ||||
|               href={line.backendUrl} | ||||
|               target="_blank" | ||||
|               className="w-4 text-xs" | ||||
|               text="B" | ||||
|             /> | ||||
|             <p>{line.subitems.join(" -> ")}</p> | ||||
|             <p>{line.name}</p> | ||||
|             <Chip text={line.type} /> | ||||
|             <Chip | ||||
|               className={ | ||||
|                 line.severity === "Very High" | ||||
|                   ? "bg-[#f00] font-bold !opacity-100" | ||||
|                   : line.severity === "High" | ||||
|                   ? "bg-[#ff6600] font-bold !opacity-100" | ||||
|                   : line.severity === "Medium" | ||||
|                   ? "bg-[#fff344] !opacity-100" | ||||
|                   : "" | ||||
|               } | ||||
|               text={line.severity} | ||||
|             /> | ||||
|             <ToolTip content={line.recommandation} placement="left"> | ||||
|               <p>{line.description}</p> | ||||
|             </ToolTip> | ||||
|           </div> | ||||
|         ))} | ||||
|             > | ||||
|               <Button | ||||
|                 href={line.frontendUrl} | ||||
|                 target="_blank" | ||||
|                 className="w-4 text-xs" | ||||
|                 text="F" | ||||
|               /> | ||||
|               <Button | ||||
|                 href={line.backendUrl} | ||||
|                 target="_blank" | ||||
|                 className="w-4 text-xs" | ||||
|                 text="B" | ||||
|               /> | ||||
|               <p>{line.subitems.join(" -> ")}</p> | ||||
|               <p>{line.name}</p> | ||||
|               <Chip text={line.type} /> | ||||
|               <Chip | ||||
|                 className={ | ||||
|                   line.severity === Severity.VeryHigh | ||||
|                     ? "bg-[#f00] font-bold !opacity-100" | ||||
|                     : line.severity === Severity.High | ||||
|                     ? "bg-[#ff6600] font-bold !opacity-100" | ||||
|                     : line.severity === Severity.Medium | ||||
|                     ? "bg-[#fff344] !opacity-100" | ||||
|                     : "" | ||||
|                 } | ||||
|                 text={Severity[line.severity]} | ||||
|               /> | ||||
|               <ToolTip content={line.recommandation} placement="left"> | ||||
|                 <p>{line.description}</p> | ||||
|               </ToolTip> | ||||
|             </div> | ||||
|           ))} | ||||
|       </ContentPanel> | ||||
|     ), | ||||
|     [testReport.lines, testReport.title] | ||||
| @ -120,22 +124,6 @@ export const getStaticProps: GetStaticProps = async (context) => { | ||||
|  * ─────────────────────────────────────╯  PRIVATE METHODS  ╰─────────────────────────────────────── | ||||
|  */ | ||||
| 
 | ||||
| type Report = { | ||||
|   title: string; | ||||
|   lines: ReportLine[]; | ||||
| }; | ||||
| 
 | ||||
| type ReportLine = { | ||||
|   subitems: string[]; | ||||
|   name: string; | ||||
|   type: "Error" | "Improvement" | "Missing"; | ||||
|   severity: "High" | "Low" | "Medium" | "Very High" | "Very Low"; | ||||
|   description: string; | ||||
|   recommandation: string; | ||||
|   backendUrl: string; | ||||
|   frontendUrl: string; | ||||
| }; | ||||
| 
 | ||||
| const testingLibraryItem = (libraryItems: Props["libraryItems"]): Report => { | ||||
|   const report: Report = { | ||||
|     title: "Contents", | ||||
| @ -152,7 +140,7 @@ const testingLibraryItem = (libraryItems: Props["libraryItems"]): Report => { | ||||
|           subitems: [item.attributes.slug], | ||||
|           name: "No Category", | ||||
|           type: "Missing", | ||||
|           severity: "Medium", | ||||
|           severity: Severity.High, | ||||
|           description: "The Item has no Category.", | ||||
|           recommandation: "Select a Category in relation with the Item", | ||||
|           backendUrl: backendUrl, | ||||
| @ -168,7 +156,7 @@ const testingLibraryItem = (libraryItems: Props["libraryItems"]): Report => { | ||||
|           subitems: [item.attributes.slug], | ||||
|           name: "Disconnected Item", | ||||
|           type: "Error", | ||||
|           severity: "Very High", | ||||
|           severity: Severity.VeryHigh, | ||||
|           description: | ||||
|             "The Item is neither a Root Item, nor is it a subitem of another item.", | ||||
|           recommandation: "", | ||||
| @ -182,7 +170,7 @@ const testingLibraryItem = (libraryItems: Props["libraryItems"]): Report => { | ||||
|           subitems: [item.attributes.slug], | ||||
|           name: "No Contents", | ||||
|           type: "Missing", | ||||
|           severity: "Low", | ||||
|           severity: Severity.Low, | ||||
|           description: "The Item has no Contents.", | ||||
|           recommandation: "", | ||||
|           backendUrl: backendUrl, | ||||
| @ -195,7 +183,7 @@ const testingLibraryItem = (libraryItems: Props["libraryItems"]): Report => { | ||||
|           subitems: [item.attributes.slug], | ||||
|           name: "No Thumbnail", | ||||
|           type: "Missing", | ||||
|           severity: "High", | ||||
|           severity: Severity.High, | ||||
|           description: "The Item has no Thumbnail.", | ||||
|           recommandation: "", | ||||
|           backendUrl: backendUrl, | ||||
| @ -208,7 +196,7 @@ const testingLibraryItem = (libraryItems: Props["libraryItems"]): Report => { | ||||
|           subitems: [item.attributes.slug], | ||||
|           name: "No Images", | ||||
|           type: "Missing", | ||||
|           severity: "Low", | ||||
|           severity: Severity.Low, | ||||
|           description: "The Item has no Images.", | ||||
|           recommandation: "", | ||||
|           backendUrl: backendUrl, | ||||
| @ -228,7 +216,7 @@ const testingLibraryItem = (libraryItems: Props["libraryItems"]): Report => { | ||||
|                   ], | ||||
|                   name: "Duplicate Language", | ||||
|                   type: "Error", | ||||
|                   severity: "High", | ||||
|                   severity: Severity.High, | ||||
|                   description: "", | ||||
|                   recommandation: "", | ||||
|                   backendUrl: backendUrl, | ||||
| @ -245,7 +233,7 @@ const testingLibraryItem = (libraryItems: Props["libraryItems"]): Report => { | ||||
|                 ], | ||||
|                 name: "No Language", | ||||
|                 type: "Error", | ||||
|                 severity: "Very High", | ||||
|                 severity: Severity.VeryHigh, | ||||
|                 description: "", | ||||
|                 recommandation: "", | ||||
|                 backendUrl: backendUrl, | ||||
| @ -261,7 +249,7 @@ const testingLibraryItem = (libraryItems: Props["libraryItems"]): Report => { | ||||
|                 ], | ||||
|                 name: "No Source Language", | ||||
|                 type: "Error", | ||||
|                 severity: "Very High", | ||||
|                 severity: Severity.VeryHigh, | ||||
|                 description: "", | ||||
|                 recommandation: "", | ||||
|                 backendUrl: backendUrl, | ||||
| @ -280,7 +268,7 @@ const testingLibraryItem = (libraryItems: Props["libraryItems"]): Report => { | ||||
|                 ], | ||||
|                 name: "Not Done Status", | ||||
|                 type: "Improvement", | ||||
|                 severity: "Low", | ||||
|                 severity: Severity.Low, | ||||
|                 description: "", | ||||
|                 recommandation: "", | ||||
|                 backendUrl: backendUrl, | ||||
| @ -297,7 +285,7 @@ const testingLibraryItem = (libraryItems: Props["libraryItems"]): Report => { | ||||
|                   ], | ||||
|                   name: "No Scanners", | ||||
|                   type: "Missing", | ||||
|                   severity: "High", | ||||
|                   severity: Severity.High, | ||||
|                   description: | ||||
|                     "The Item is a Scan but doesn't credit any Scanners.", | ||||
|                   recommandation: "Add the appropriate Scanners.", | ||||
| @ -313,7 +301,7 @@ const testingLibraryItem = (libraryItems: Props["libraryItems"]): Report => { | ||||
|                   ], | ||||
|                   name: "No Cleaners", | ||||
|                   type: "Missing", | ||||
|                   severity: "High", | ||||
|                   severity: Severity.High, | ||||
|                   description: | ||||
|                     "The Item is a Scan but doesn't credit any Cleaners.", | ||||
|                   recommandation: "Add the appropriate Cleaners.", | ||||
| @ -332,7 +320,7 @@ const testingLibraryItem = (libraryItems: Props["libraryItems"]): Report => { | ||||
|                   ], | ||||
|                   name: "Credited Typesetters", | ||||
|                   type: "Error", | ||||
|                   severity: "High", | ||||
|                   severity: Severity.High, | ||||
|                   description: | ||||
|                     "The Item is a Scan but credits one or more Typesetters.", | ||||
|                   recommandation: | ||||
| @ -350,7 +338,7 @@ const testingLibraryItem = (libraryItems: Props["libraryItems"]): Report => { | ||||
|                   ], | ||||
|                   name: "No Typesetters", | ||||
|                   type: "Missing", | ||||
|                   severity: "High", | ||||
|                   severity: Severity.High, | ||||
|                   description: | ||||
|                     "The Item is a Scanlation but doesn't credit any Typesetters.", | ||||
|                   recommandation: "Add the appropriate Typesetters.", | ||||
| @ -366,7 +354,7 @@ const testingLibraryItem = (libraryItems: Props["libraryItems"]): Report => { | ||||
|                   ], | ||||
|                   name: "Credited Scanners", | ||||
|                   type: "Error", | ||||
|                   severity: "High", | ||||
|                   severity: Severity.High, | ||||
|                   description: | ||||
|                     "The Item is a Scanlation but credits one or more Scanners.", | ||||
|                   recommandation: | ||||
| @ -387,7 +375,7 @@ const testingLibraryItem = (libraryItems: Props["libraryItems"]): Report => { | ||||
|                   ], | ||||
|                   name: "No Front", | ||||
|                   type: "Missing", | ||||
|                   severity: "Very High", | ||||
|                   severity: Severity.VeryHigh, | ||||
|                   description: "", | ||||
|                   recommandation: "", | ||||
|                   backendUrl: backendUrl, | ||||
| @ -403,7 +391,7 @@ const testingLibraryItem = (libraryItems: Props["libraryItems"]): Report => { | ||||
|                   ], | ||||
|                   name: "No spine", | ||||
|                   type: "Missing", | ||||
|                   severity: "Low", | ||||
|                   severity: Severity.Low, | ||||
|                   description: "", | ||||
|                   recommandation: "", | ||||
|                   backendUrl: backendUrl, | ||||
| @ -419,7 +407,7 @@ const testingLibraryItem = (libraryItems: Props["libraryItems"]): Report => { | ||||
|                   ], | ||||
|                   name: "No Back", | ||||
|                   type: "Missing", | ||||
|                   severity: "High", | ||||
|                   severity: Severity.High, | ||||
|                   description: "", | ||||
|                   recommandation: "", | ||||
|                   backendUrl: backendUrl, | ||||
| @ -435,7 +423,7 @@ const testingLibraryItem = (libraryItems: Props["libraryItems"]): Report => { | ||||
|                   ], | ||||
|                   name: "No Full", | ||||
|                   type: "Missing", | ||||
|                   severity: "Low", | ||||
|                   severity: Severity.Low, | ||||
|                   description: "", | ||||
|                   recommandation: "", | ||||
|                   backendUrl: backendUrl, | ||||
| @ -450,7 +438,7 @@ const testingLibraryItem = (libraryItems: Props["libraryItems"]): Report => { | ||||
|                 ], | ||||
|                 name: "No Cover", | ||||
|                 type: "Missing", | ||||
|                 severity: "Medium", | ||||
|                 severity: Severity.Medium, | ||||
|                 description: "", | ||||
|                 recommandation: "", | ||||
|                 backendUrl: backendUrl, | ||||
| @ -468,7 +456,7 @@ const testingLibraryItem = (libraryItems: Props["libraryItems"]): Report => { | ||||
|                   ], | ||||
|                   name: "No Front", | ||||
|                   type: "Missing", | ||||
|                   severity: "Very High", | ||||
|                   severity: Severity.VeryHigh, | ||||
|                   description: "", | ||||
|                   recommandation: "", | ||||
|                   backendUrl: backendUrl, | ||||
| @ -484,7 +472,7 @@ const testingLibraryItem = (libraryItems: Props["libraryItems"]): Report => { | ||||
|                   ], | ||||
|                   name: "No spine", | ||||
|                   type: "Missing", | ||||
|                   severity: "Low", | ||||
|                   severity: Severity.Low, | ||||
|                   description: "", | ||||
|                   recommandation: "", | ||||
|                   backendUrl: backendUrl, | ||||
| @ -500,7 +488,7 @@ const testingLibraryItem = (libraryItems: Props["libraryItems"]): Report => { | ||||
|                   ], | ||||
|                   name: "No Back", | ||||
|                   type: "Missing", | ||||
|                   severity: "High", | ||||
|                   severity: Severity.High, | ||||
|                   description: "", | ||||
|                   recommandation: "", | ||||
|                   backendUrl: backendUrl, | ||||
| @ -516,7 +504,7 @@ const testingLibraryItem = (libraryItems: Props["libraryItems"]): Report => { | ||||
|                   ], | ||||
|                   name: "No Full", | ||||
|                   type: "Missing", | ||||
|                   severity: "Low", | ||||
|                   severity: Severity.Low, | ||||
|                   description: "", | ||||
|                   recommandation: "", | ||||
|                   backendUrl: backendUrl, | ||||
| @ -532,7 +520,7 @@ const testingLibraryItem = (libraryItems: Props["libraryItems"]): Report => { | ||||
|                   ], | ||||
|                   name: "No Flap Front", | ||||
|                   type: "Missing", | ||||
|                   severity: "Medium", | ||||
|                   severity: Severity.Medium, | ||||
|                   description: "", | ||||
|                   recommandation: "", | ||||
|                   backendUrl: backendUrl, | ||||
| @ -548,7 +536,7 @@ const testingLibraryItem = (libraryItems: Props["libraryItems"]): Report => { | ||||
|                   ], | ||||
|                   name: "No Flap Back", | ||||
|                   type: "Missing", | ||||
|                   severity: "Medium", | ||||
|                   severity: Severity.Medium, | ||||
|                   description: "", | ||||
|                   recommandation: "", | ||||
|                   backendUrl: backendUrl, | ||||
| @ -563,7 +551,7 @@ const testingLibraryItem = (libraryItems: Props["libraryItems"]): Report => { | ||||
|                 ], | ||||
|                 name: "No Dust Jacket", | ||||
|                 type: "Missing", | ||||
|                 severity: "Very Low", | ||||
|                 severity: Severity.VeryLow, | ||||
|                 description: "", | ||||
|                 recommandation: "", | ||||
|                 backendUrl: backendUrl, | ||||
| @ -581,7 +569,7 @@ const testingLibraryItem = (libraryItems: Props["libraryItems"]): Report => { | ||||
|                   ], | ||||
|                   name: "No Front", | ||||
|                   type: "Missing", | ||||
|                   severity: "Very High", | ||||
|                   severity: Severity.VeryHigh, | ||||
|                   description: "", | ||||
|                   recommandation: "", | ||||
|                   backendUrl: backendUrl, | ||||
| @ -597,7 +585,7 @@ const testingLibraryItem = (libraryItems: Props["libraryItems"]): Report => { | ||||
|                   ], | ||||
|                   name: "No spine", | ||||
|                   type: "Missing", | ||||
|                   severity: "Low", | ||||
|                   severity: Severity.Low, | ||||
|                   description: "", | ||||
|                   recommandation: "", | ||||
|                   backendUrl: backendUrl, | ||||
| @ -613,7 +601,7 @@ const testingLibraryItem = (libraryItems: Props["libraryItems"]): Report => { | ||||
|                   ], | ||||
|                   name: "No Back", | ||||
|                   type: "Missing", | ||||
|                   severity: "High", | ||||
|                   severity: Severity.High, | ||||
|                   description: "", | ||||
|                   recommandation: "", | ||||
|                   backendUrl: backendUrl, | ||||
| @ -629,7 +617,7 @@ const testingLibraryItem = (libraryItems: Props["libraryItems"]): Report => { | ||||
|                   ], | ||||
|                   name: "No Full", | ||||
|                   type: "Missing", | ||||
|                   severity: "Low", | ||||
|                   severity: Severity.Low, | ||||
|                   description: "", | ||||
|                   recommandation: "", | ||||
|                   backendUrl: backendUrl, | ||||
| @ -645,7 +633,7 @@ const testingLibraryItem = (libraryItems: Props["libraryItems"]): Report => { | ||||
|                   ], | ||||
|                   name: "No Flap Front", | ||||
|                   type: "Missing", | ||||
|                   severity: "Medium", | ||||
|                   severity: Severity.Medium, | ||||
|                   description: "", | ||||
|                   recommandation: "", | ||||
|                   backendUrl: backendUrl, | ||||
| @ -661,7 +649,7 @@ const testingLibraryItem = (libraryItems: Props["libraryItems"]): Report => { | ||||
|                   ], | ||||
|                   name: "No Flap Back", | ||||
|                   type: "Missing", | ||||
|                   severity: "Medium", | ||||
|                   severity: Severity.Medium, | ||||
|                   description: "", | ||||
|                   recommandation: "", | ||||
|                   backendUrl: backendUrl, | ||||
| @ -676,7 +664,7 @@ const testingLibraryItem = (libraryItems: Props["libraryItems"]): Report => { | ||||
|                 ], | ||||
|                 name: "No Obi Belt", | ||||
|                 type: "Missing", | ||||
|                 severity: "Very Low", | ||||
|                 severity: Severity.VeryLow, | ||||
|                 description: "", | ||||
|                 recommandation: "", | ||||
|                 backendUrl: backendUrl, | ||||
| @ -703,7 +691,7 @@ const testingLibraryItem = (libraryItems: Props["libraryItems"]): Report => { | ||||
|                 ], | ||||
|                 name: "No Text", | ||||
|                 type: "Missing", | ||||
|                 severity: "Very High", | ||||
|                 severity: Severity.VeryHigh, | ||||
|                 description: "", | ||||
|                 recommandation: "", | ||||
|                 backendUrl: backendUrl, | ||||
| @ -720,7 +708,7 @@ const testingLibraryItem = (libraryItems: Props["libraryItems"]): Report => { | ||||
|                   ], | ||||
|                   name: "Duplicate Language", | ||||
|                   type: "Error", | ||||
|                   severity: "High", | ||||
|                   severity: Severity.High, | ||||
|                   description: "", | ||||
|                   recommandation: "", | ||||
|                   backendUrl: backendUrl, | ||||
| @ -737,7 +725,7 @@ const testingLibraryItem = (libraryItems: Props["libraryItems"]): Report => { | ||||
|                 ], | ||||
|                 name: "No Language", | ||||
|                 type: "Error", | ||||
|                 severity: "Very High", | ||||
|                 severity: Severity.VeryHigh, | ||||
|                 description: "", | ||||
|                 recommandation: "", | ||||
|                 backendUrl: backendUrl, | ||||
| @ -751,7 +739,7 @@ const testingLibraryItem = (libraryItems: Props["libraryItems"]): Report => { | ||||
|           subitems: [item.attributes.slug], | ||||
|           name: "No Description", | ||||
|           type: "Missing", | ||||
|           severity: "Medium", | ||||
|           severity: Severity.Medium, | ||||
|           description: "The Item has no Description.", | ||||
|           recommandation: "", | ||||
|           backendUrl: backendUrl, | ||||
| @ -764,7 +752,7 @@ const testingLibraryItem = (libraryItems: Props["libraryItems"]): Report => { | ||||
|           subitems: [item.attributes.slug], | ||||
|           name: "No URLs", | ||||
|           type: "Missing", | ||||
|           severity: "Very Low", | ||||
|           severity: Severity.VeryLow, | ||||
|           description: "The Item has no URLs.", | ||||
|           recommandation: "", | ||||
|           backendUrl: backendUrl, | ||||
|  | ||||
| @ -407,7 +407,7 @@ const Editor = ({ langui, ...otherProps }: Props): JSX.Element => { | ||||
|               <h3 className="text-lg">Player’s name placeholder</h3> | ||||
|             } | ||||
|           > | ||||
|             <Button onClick={() => insert("<player>")} icon={Icon.Person} /> | ||||
|             <Button onClick={() => insert("@player")} icon={Icon.Person} /> | ||||
|           </ToolTip> | ||||
| 
 | ||||
|           <ToolTip | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 DrMint
						DrMint