diff --git a/app/components/editor/index.tsx b/app/components/editor/index.tsx index b69f093..1c91ba4 100755 --- a/app/components/editor/index.tsx +++ b/app/components/editor/index.tsx @@ -40,6 +40,7 @@ export const EditorScreen = () => { data: enforceContextData, }); const [casbinVersion, setCasbinVersion] = useState(''); + const [showCustomConfig, setShowCustomConfig] = useState(false); const sidePanelChatRef = useRef<{ openDrawer: (message: string) => void } | null>(null); const openDrawerWithMessage = (message: string) => { if (sidePanelChatRef.current) { @@ -90,8 +91,15 @@ export const EditorScreen = () => { const textClass = clsx(theme === 'dark' ? 'text-gray-200' : 'text-gray-800'); return ( -
-
+
+
-
{open &&
{t('Custom config')}
}
+
+ {(showCustomConfig || open) &&
{t('Custom config')}
} +
- {open && ( + {(showCustomConfig || open) && (
{
-
-
+
+
{t('Model')}
@@ -181,7 +192,34 @@ export const EditorScreen = () => { > {t('RESET')} +
+ +
+
{ EditorView.lineWrapping, buttonPlugin(openDrawerWithMessage, extractContent, 'model'), ]} - className={'function flex-grow'} + className={'function flex-grow h-[300px]'} value={modelText} />
-
+
{t('Request')}
@@ -302,14 +340,14 @@ export const EditorScreen = () => { bracketMatching: true, indentOnInput: true, }} - className={'function flex-grow '} + className={'function flex-grow h-[300px]'} value={request} />
-
+
{t('Enforcement Result')}
@@ -337,76 +375,74 @@ export const EditorScreen = () => { bracketMatching: true, indentOnInput: true, }} - className={'cursor-not-allowed flex-grow'} + className={'cursor-not-allowed flex-grow h-[300px]'} value={requestResult} />
-
- - - {!share ? ( - +
+
+ + + {!share ? ( - - ) : ( - - )} -
- {echo} -
-
- - + > + {t('COPY')} + + )} +
+ +
+
{echo}
+ +
+ + +
diff --git a/app/layout.tsx b/app/layout.tsx index dc33995..033dd28 100644 --- a/app/layout.tsx +++ b/app/layout.tsx @@ -17,7 +17,7 @@ import './globals.css'; import { LangProvider } from './context/LangContext'; export const metadata: Metadata = { - title: 'casbin-editor', + title: 'Casbin Policy Editor', description: 'web playground for casbin', }; diff --git a/app/page.tsx b/app/page.tsx index 7941c03..2fa0249 100644 --- a/app/page.tsx +++ b/app/page.tsx @@ -20,16 +20,15 @@ import { useLang } from '@/app/context/LangContext'; export default function Home() { const { theme } = useLang(); return ( -
-
+
+
-
- +
+ GitHub stars -
- Copyright © {new Date().getFullYear()} Casbin contributors. + Copyright © {new Date().getFullYear()} Casbin contributors.
);