Compare commits

..

No commits in common. "feat/env-toggle-module-repo-sync" and "main" have entirely different histories.

2 changed files with 18 additions and 31 deletions

View File

@ -99,7 +99,6 @@ export const ModuleBuilderTabContent: React.FC = () => {
const [creatingModule, setCreatingModule] = useState(false); const [creatingModule, setCreatingModule] = useState(false);
const [exportingZip, setExportingZip] = useState(false); const [exportingZip, setExportingZip] = useState(false);
const [syncingRepo, setSyncingRepo] = useState(false); const [syncingRepo, setSyncingRepo] = useState(false);
const [syncRepoEnabled, setSyncRepoEnabled] = useState(false);
const [showExportMenu, setShowExportMenu] = useState(false); const [showExportMenu, setShowExportMenu] = useState(false);
const [categories, setCategories] = useState<BuilderCategorySummary[]>([]); const [categories, setCategories] = useState<BuilderCategorySummary[]>([]);
@ -158,10 +157,6 @@ export const ModuleBuilderTabContent: React.FC = () => {
useEffect(() => { useEffect(() => {
fetchModules(); fetchModules();
moduleBuilderService
.getConfig()
.then((cfg) => setSyncRepoEnabled(Boolean(cfg?.sync_repo_enabled)))
.catch(() => setSyncRepoEnabled(false));
}, []); }, []);
// Compute active module object // Compute active module object
@ -1278,27 +1273,25 @@ export const ModuleBuilderTabContent: React.FC = () => {
</div> </div>
</button> </button>
{syncRepoEnabled && ( <button
<button type="button"
type="button" onClick={() => {
onClick={() => { setShowExportMenu(false);
setShowExportMenu(false); handleSyncContentRepo();
handleSyncContentRepo(); }}
}} disabled={syncingRepo}
disabled={syncingRepo} className="w-full text-left px-3.5 py-2.5 hover:bg-emerald-50/50 flex items-start gap-2.5 transition-colors group"
className="w-full text-left px-3.5 py-2.5 hover:bg-emerald-50/50 flex items-start gap-2.5 transition-colors group" >
> <UploadCloud className="h-4 w-4 text-emerald-600 mt-0.5 shrink-0" />
<UploadCloud className="h-4 w-4 text-emerald-600 mt-0.5 shrink-0" /> <div>
<div> <div className="text-xs font-bold text-slate-800 group-hover:text-emerald-600">
<div className="text-xs font-bold text-slate-800 group-hover:text-emerald-600"> Sync to Server Repository
Sync to Server Repository
</div>
<div className="text-[10px] text-slate-400">
Compile and write directly to server content repository
</div>
</div> </div>
</button> <div className="text-[10px] text-slate-400">
)} Compile and write directly to server content repository
</div>
</div>
</button>
<div className="my-1 border-t border-slate-100" /> <div className="my-1 border-t border-slate-100" />

View File

@ -219,12 +219,6 @@ export const moduleBuilderService = {
return res.data; return res.data;
}, },
// Feature config
async getConfig(): Promise<{ sync_repo_enabled: boolean }> {
const res = await api.get('/api/admin/module-builder/config');
return res.data;
},
// Import JSON // Import JSON
async importModuleJson(moduleCode: string, contents: any[]): Promise<any> { async importModuleJson(moduleCode: string, contents: any[]): Promise<any> {
const res = await api.post(`/api/admin/module-builder/${moduleCode}/import-json`, { contents }); const res = await api.post(`/api/admin/module-builder/${moduleCode}/import-json`, { contents });