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",
 | 
			
		||||
          component: "Description",
 | 
			
		||||
          tabComponent: "Description",
 | 
			
		||||
          title: t("Description"),
 | 
			
		||||
          params: {
 | 
			
		||||
            icon: FileTextIcon,
 | 
			
		||||
            content: Description,
 | 
			
		||||
            title: t("Description"),
 | 
			
		||||
          },
 | 
			
		||||
        },
 | 
			
		||||
        {
 | 
			
		||||
          id: "Solutions",
 | 
			
		||||
          component: "Solutions",
 | 
			
		||||
          tabComponent: "Solutions",
 | 
			
		||||
          title: t("Solutions"),
 | 
			
		||||
          params: {
 | 
			
		||||
            icon: FlaskConicalIcon,
 | 
			
		||||
            content: Solutions,
 | 
			
		||||
            title: t("Solutions"),
 | 
			
		||||
          },
 | 
			
		||||
          position: {
 | 
			
		||||
            referencePanel: "Description",
 | 
			
		||||
@ -78,10 +78,10 @@ export default function ProblemPage({
 | 
			
		||||
          id: "Submissions",
 | 
			
		||||
          component: "Submissions",
 | 
			
		||||
          tabComponent: "Submissions",
 | 
			
		||||
          title: t("Submissions"),
 | 
			
		||||
          params: {
 | 
			
		||||
            icon: CircleCheckBigIcon,
 | 
			
		||||
            content: Submissions,
 | 
			
		||||
            title: t("Submissions"),
 | 
			
		||||
          },
 | 
			
		||||
          position: {
 | 
			
		||||
            referencePanel: "Solutions",
 | 
			
		||||
@ -93,10 +93,10 @@ export default function ProblemPage({
 | 
			
		||||
          id: "Details",
 | 
			
		||||
          component: "Details",
 | 
			
		||||
          tabComponent: "Details",
 | 
			
		||||
          title: t("Details"),
 | 
			
		||||
          params: {
 | 
			
		||||
            icon: CircleCheckBigIcon,
 | 
			
		||||
            content: Details,
 | 
			
		||||
            title: t("Details"),
 | 
			
		||||
            autoAdd: false,
 | 
			
		||||
          },
 | 
			
		||||
        },
 | 
			
		||||
@ -104,10 +104,10 @@ export default function ProblemPage({
 | 
			
		||||
          id: "Code",
 | 
			
		||||
          component: "Code",
 | 
			
		||||
          tabComponent: "Code",
 | 
			
		||||
          title: t("Code"),
 | 
			
		||||
          params: {
 | 
			
		||||
            icon: SquarePenIcon,
 | 
			
		||||
            content: Code,
 | 
			
		||||
            title: t("Code"),
 | 
			
		||||
          },
 | 
			
		||||
          position: {
 | 
			
		||||
            referencePanel: "Submissions",
 | 
			
		||||
@ -118,10 +118,10 @@ export default function ProblemPage({
 | 
			
		||||
          id: "Testcase",
 | 
			
		||||
          component: "Testcase",
 | 
			
		||||
          tabComponent: "Testcase",
 | 
			
		||||
          title: t("Testcase"),
 | 
			
		||||
          params: {
 | 
			
		||||
            icon: SquareCheckIcon,
 | 
			
		||||
            content: Testcase,
 | 
			
		||||
            title: t("Testcase"),
 | 
			
		||||
          },
 | 
			
		||||
          position: {
 | 
			
		||||
            referencePanel: "Code",
 | 
			
		||||
@ -132,10 +132,10 @@ export default function ProblemPage({
 | 
			
		||||
          id: "Bot",
 | 
			
		||||
          component: "Bot",
 | 
			
		||||
          tabComponent: "Bot",
 | 
			
		||||
          title: t("Bot"),
 | 
			
		||||
          params: {
 | 
			
		||||
            icon: BotIcon,
 | 
			
		||||
            content: Bot,
 | 
			
		||||
            title: t("Bot"),
 | 
			
		||||
            autoAdd: false,
 | 
			
		||||
          },
 | 
			
		||||
          position: {
 | 
			
		||||
 | 
			
		||||
@ -15,6 +15,7 @@ import { DockviewReact, themeAbyssSpaced } from "dockview";
 | 
			
		||||
interface PanelContent {
 | 
			
		||||
  icon?: LucideIcon;
 | 
			
		||||
  content?: React.ReactNode;
 | 
			
		||||
  title?: string;
 | 
			
		||||
  autoAdd?: boolean;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -45,7 +46,7 @@ export default function DockView({ storageKey, onApiReady, options }: DockviewPr
 | 
			
		||||
        return <>{content}</>;
 | 
			
		||||
      };
 | 
			
		||||
 | 
			
		||||
      tabComponents[id] = (props) => {
 | 
			
		||||
      tabComponents[id] = () => {
 | 
			
		||||
        const Icon = params?.icon;
 | 
			
		||||
        return (
 | 
			
		||||
          <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"
 | 
			
		||||
              />
 | 
			
		||||
            )}
 | 
			
		||||
            {props.api.title}
 | 
			
		||||
            {params?.title}
 | 
			
		||||
          </div>
 | 
			
		||||
        );
 | 
			
		||||
      };
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user