完善不可识别Scheme的警告页面。
This commit is contained in:
		@@ -47,7 +47,7 @@ export function schemeType(
 | 
				
			|||||||
  const useShort = short ?? false;
 | 
					  const useShort = short ?? false;
 | 
				
			||||||
  const foundType = find(SchemeTypeOptions, { value }) as SchemeTypeOption | undefined;
 | 
					  const foundType = find(SchemeTypeOptions, { value }) as SchemeTypeOption | undefined;
 | 
				
			||||||
  if (isNil(foundType)) {
 | 
					  if (isNil(foundType)) {
 | 
				
			||||||
    return null;
 | 
					    return 'CORRUPTED';
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  return useShort ? foundType.short : foundType.label;
 | 
					  return useShort ? foundType.short : foundType.label;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										6
									
								
								src/page-components/scheme/CorruptedScheme.module.css
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										6
									
								
								src/page-components/scheme/CorruptedScheme.module.css
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,6 @@
 | 
				
			|||||||
 | 
					@layer pages {
 | 
				
			||||||
 | 
					  .corrupted {
 | 
				
			||||||
 | 
					    font-size: var(--font-size-xl);
 | 
				
			||||||
 | 
					    color: var(--color-danger);
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
							
								
								
									
										8
									
								
								src/page-components/scheme/CorruptedScheme.tsx
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								src/page-components/scheme/CorruptedScheme.tsx
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,8 @@
 | 
				
			|||||||
 | 
					import styles from './CorruptedScheme.module.css';
 | 
				
			||||||
 | 
					export function CorruptedScheme() {
 | 
				
			||||||
 | 
					  return (
 | 
				
			||||||
 | 
					    <div className="center">
 | 
				
			||||||
 | 
					      <div className={styles.corrupted}>Unrecognizable or corrupted scheme</div>
 | 
				
			||||||
 | 
					    </div>
 | 
				
			||||||
 | 
					  );
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@@ -1,3 +0,0 @@
 | 
				
			|||||||
export function UnknownScheme() {
 | 
					 | 
				
			||||||
  return <div>Unknown or currupted scheme</div>;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
@@ -5,11 +5,11 @@ import { useNavigate, useParams } from 'react-router-dom';
 | 
				
			|||||||
import { EditableDescription } from '../components/EditableDescription';
 | 
					import { EditableDescription } from '../components/EditableDescription';
 | 
				
			||||||
import { EditableTitle } from '../components/EditableTitle';
 | 
					import { EditableTitle } from '../components/EditableTitle';
 | 
				
			||||||
import { SchemeSign } from '../components/SchemeSign';
 | 
					import { SchemeSign } from '../components/SchemeSign';
 | 
				
			||||||
 | 
					import { CorruptedScheme } from '../page-components/scheme/CorruptedScheme';
 | 
				
			||||||
import { M2Scheme } from '../page-components/scheme/M2Scheme';
 | 
					import { M2Scheme } from '../page-components/scheme/M2Scheme';
 | 
				
			||||||
import { M3Scheme } from '../page-components/scheme/M3Scheme';
 | 
					import { M3Scheme } from '../page-components/scheme/M3Scheme';
 | 
				
			||||||
import { QScheme } from '../page-components/scheme/QScheme';
 | 
					import { QScheme } from '../page-components/scheme/QScheme';
 | 
				
			||||||
import { SwatchScheme } from '../page-components/scheme/SwatchScheme';
 | 
					import { SwatchScheme } from '../page-components/scheme/SwatchScheme';
 | 
				
			||||||
import { UnknownScheme } from '../page-components/scheme/UnknownScheme';
 | 
					 | 
				
			||||||
import { useScheme, useUpdateScheme } from '../stores/schemes';
 | 
					import { useScheme, useUpdateScheme } from '../stores/schemes';
 | 
				
			||||||
import styles from './SchemeDetail.module.css';
 | 
					import styles from './SchemeDetail.module.css';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -48,7 +48,7 @@ export function SchemeDetail() {
 | 
				
			|||||||
      case 'material_3':
 | 
					      case 'material_3':
 | 
				
			||||||
        return <M3Scheme />;
 | 
					        return <M3Scheme />;
 | 
				
			||||||
      default:
 | 
					      default:
 | 
				
			||||||
        return <UnknownScheme />;
 | 
					        return <CorruptedScheme />;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
  }, [scheme]);
 | 
					  }, [scheme]);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user