mirror of
				https://github.com/massbug/judge4c.git
				synced 2025-11-04 10:46:46 +00:00 
			
		
		
		
	fix(dockview): move panel titles from options to params to prevent i18n title persistence in layout
This commit is contained in:
		
							parent
							
								
									f40a8d3821
								
							
						
					
					
						commit
						64182bccc6
					
				@ -53,20 +53,20 @@ export default function ProblemPage({
 | 
				
			|||||||
          id: "Description",
 | 
					          id: "Description",
 | 
				
			||||||
          component: "Description",
 | 
					          component: "Description",
 | 
				
			||||||
          tabComponent: "Description",
 | 
					          tabComponent: "Description",
 | 
				
			||||||
          title: t("Description"),
 | 
					 | 
				
			||||||
          params: {
 | 
					          params: {
 | 
				
			||||||
            icon: FileTextIcon,
 | 
					            icon: FileTextIcon,
 | 
				
			||||||
            content: Description,
 | 
					            content: Description,
 | 
				
			||||||
 | 
					            title: t("Description"),
 | 
				
			||||||
          },
 | 
					          },
 | 
				
			||||||
        },
 | 
					        },
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
          id: "Solutions",
 | 
					          id: "Solutions",
 | 
				
			||||||
          component: "Solutions",
 | 
					          component: "Solutions",
 | 
				
			||||||
          tabComponent: "Solutions",
 | 
					          tabComponent: "Solutions",
 | 
				
			||||||
          title: t("Solutions"),
 | 
					 | 
				
			||||||
          params: {
 | 
					          params: {
 | 
				
			||||||
            icon: FlaskConicalIcon,
 | 
					            icon: FlaskConicalIcon,
 | 
				
			||||||
            content: Solutions,
 | 
					            content: Solutions,
 | 
				
			||||||
 | 
					            title: t("Solutions"),
 | 
				
			||||||
          },
 | 
					          },
 | 
				
			||||||
          position: {
 | 
					          position: {
 | 
				
			||||||
            referencePanel: "Description",
 | 
					            referencePanel: "Description",
 | 
				
			||||||
@ -78,10 +78,10 @@ export default function ProblemPage({
 | 
				
			|||||||
          id: "Submissions",
 | 
					          id: "Submissions",
 | 
				
			||||||
          component: "Submissions",
 | 
					          component: "Submissions",
 | 
				
			||||||
          tabComponent: "Submissions",
 | 
					          tabComponent: "Submissions",
 | 
				
			||||||
          title: t("Submissions"),
 | 
					 | 
				
			||||||
          params: {
 | 
					          params: {
 | 
				
			||||||
            icon: CircleCheckBigIcon,
 | 
					            icon: CircleCheckBigIcon,
 | 
				
			||||||
            content: Submissions,
 | 
					            content: Submissions,
 | 
				
			||||||
 | 
					            title: t("Submissions"),
 | 
				
			||||||
          },
 | 
					          },
 | 
				
			||||||
          position: {
 | 
					          position: {
 | 
				
			||||||
            referencePanel: "Solutions",
 | 
					            referencePanel: "Solutions",
 | 
				
			||||||
@ -93,10 +93,10 @@ export default function ProblemPage({
 | 
				
			|||||||
          id: "Details",
 | 
					          id: "Details",
 | 
				
			||||||
          component: "Details",
 | 
					          component: "Details",
 | 
				
			||||||
          tabComponent: "Details",
 | 
					          tabComponent: "Details",
 | 
				
			||||||
          title: t("Details"),
 | 
					 | 
				
			||||||
          params: {
 | 
					          params: {
 | 
				
			||||||
            icon: CircleCheckBigIcon,
 | 
					            icon: CircleCheckBigIcon,
 | 
				
			||||||
            content: Details,
 | 
					            content: Details,
 | 
				
			||||||
 | 
					            title: t("Details"),
 | 
				
			||||||
            autoAdd: false,
 | 
					            autoAdd: false,
 | 
				
			||||||
          },
 | 
					          },
 | 
				
			||||||
        },
 | 
					        },
 | 
				
			||||||
@ -104,10 +104,10 @@ export default function ProblemPage({
 | 
				
			|||||||
          id: "Code",
 | 
					          id: "Code",
 | 
				
			||||||
          component: "Code",
 | 
					          component: "Code",
 | 
				
			||||||
          tabComponent: "Code",
 | 
					          tabComponent: "Code",
 | 
				
			||||||
          title: t("Code"),
 | 
					 | 
				
			||||||
          params: {
 | 
					          params: {
 | 
				
			||||||
            icon: SquarePenIcon,
 | 
					            icon: SquarePenIcon,
 | 
				
			||||||
            content: Code,
 | 
					            content: Code,
 | 
				
			||||||
 | 
					            title: t("Code"),
 | 
				
			||||||
          },
 | 
					          },
 | 
				
			||||||
          position: {
 | 
					          position: {
 | 
				
			||||||
            referencePanel: "Submissions",
 | 
					            referencePanel: "Submissions",
 | 
				
			||||||
@ -118,10 +118,10 @@ export default function ProblemPage({
 | 
				
			|||||||
          id: "Testcase",
 | 
					          id: "Testcase",
 | 
				
			||||||
          component: "Testcase",
 | 
					          component: "Testcase",
 | 
				
			||||||
          tabComponent: "Testcase",
 | 
					          tabComponent: "Testcase",
 | 
				
			||||||
          title: t("Testcase"),
 | 
					 | 
				
			||||||
          params: {
 | 
					          params: {
 | 
				
			||||||
            icon: SquareCheckIcon,
 | 
					            icon: SquareCheckIcon,
 | 
				
			||||||
            content: Testcase,
 | 
					            content: Testcase,
 | 
				
			||||||
 | 
					            title: t("Testcase"),
 | 
				
			||||||
          },
 | 
					          },
 | 
				
			||||||
          position: {
 | 
					          position: {
 | 
				
			||||||
            referencePanel: "Code",
 | 
					            referencePanel: "Code",
 | 
				
			||||||
@ -132,10 +132,10 @@ export default function ProblemPage({
 | 
				
			|||||||
          id: "Bot",
 | 
					          id: "Bot",
 | 
				
			||||||
          component: "Bot",
 | 
					          component: "Bot",
 | 
				
			||||||
          tabComponent: "Bot",
 | 
					          tabComponent: "Bot",
 | 
				
			||||||
          title: t("Bot"),
 | 
					 | 
				
			||||||
          params: {
 | 
					          params: {
 | 
				
			||||||
            icon: BotIcon,
 | 
					            icon: BotIcon,
 | 
				
			||||||
            content: Bot,
 | 
					            content: Bot,
 | 
				
			||||||
 | 
					            title: t("Bot"),
 | 
				
			||||||
            autoAdd: false,
 | 
					            autoAdd: false,
 | 
				
			||||||
          },
 | 
					          },
 | 
				
			||||||
          position: {
 | 
					          position: {
 | 
				
			||||||
 | 
				
			|||||||
@ -15,6 +15,7 @@ import { DockviewReact, themeAbyssSpaced } from "dockview";
 | 
				
			|||||||
interface PanelContent {
 | 
					interface PanelContent {
 | 
				
			||||||
  icon?: LucideIcon;
 | 
					  icon?: LucideIcon;
 | 
				
			||||||
  content?: React.ReactNode;
 | 
					  content?: React.ReactNode;
 | 
				
			||||||
 | 
					  title?: string;
 | 
				
			||||||
  autoAdd?: boolean;
 | 
					  autoAdd?: boolean;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -45,7 +46,7 @@ export default function DockView({ storageKey, onApiReady, options }: DockviewPr
 | 
				
			|||||||
        return <>{content}</>;
 | 
					        return <>{content}</>;
 | 
				
			||||||
      };
 | 
					      };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      tabComponents[id] = (props) => {
 | 
					      tabComponents[id] = () => {
 | 
				
			||||||
        const Icon = params?.icon;
 | 
					        const Icon = params?.icon;
 | 
				
			||||||
        return (
 | 
					        return (
 | 
				
			||||||
          <div className="flex items-center px-1 text-sm font-medium">
 | 
					          <div className="flex items-center px-1 text-sm font-medium">
 | 
				
			||||||
@ -56,7 +57,7 @@ export default function DockView({ storageKey, onApiReady, options }: DockviewPr
 | 
				
			|||||||
                aria-hidden="true"
 | 
					                aria-hidden="true"
 | 
				
			||||||
              />
 | 
					              />
 | 
				
			||||||
            )}
 | 
					            )}
 | 
				
			||||||
            {props.api.title}
 | 
					            {params?.title}
 | 
				
			||||||
          </div>
 | 
					          </div>
 | 
				
			||||||
        );
 | 
					        );
 | 
				
			||||||
      };
 | 
					      };
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user