diff --git a/app/missions/[missionId]/page.tsx b/app/missions/[missionId]/page.tsx index 7fe03d8..d5b5770 100644 --- a/app/missions/[missionId]/page.tsx +++ b/app/missions/[missionId]/page.tsx @@ -191,59 +191,6 @@ export default function MissionDetailPage() { }; }; - // Function to convert application URL to iframe URL - // Example: parole.slm-lab.net/channel/xxx -> hub.slm-lab.net/parole/channel/xxx - const convertToIframeUrl = (appUrl: string | null | undefined): string | null => { - if (!appUrl) return null; - - try { - // If it's already a full URL, parse it - if (appUrl.startsWith('http://') || appUrl.startsWith('https://')) { - const url = new URL(appUrl); - const hostname = url.hostname; - const pathname = url.pathname; - const search = url.search; - - // Extract subdomain (e.g., "parole" from "parole.slm-lab.net") - const subdomainMatch = hostname.match(/^([^.]+)\.slm-lab\.net$/); - if (!subdomainMatch) { - // If URL doesn't match expected pattern, return original - return appUrl; - } - - const subdomain = subdomainMatch[1]; - // Remove leading slash from pathname if present - const cleanPath = pathname.startsWith('/') ? pathname.substring(1) : pathname; - - // Build iframe URL: hub.slm-lab.net/[subdomain]/[path][search] - const iframeUrl = `https://hub.slm-lab.net/${subdomain}/${cleanPath}${search}`; - return iframeUrl; - } else { - // If it's not a full URL, assume it's a relative path and return as is - // (This shouldn't happen for these fields, but handle it gracefully) - return appUrl; - } - } catch (error) { - console.error('Error converting URL to iframe URL:', error); - return appUrl; // Return original URL if conversion fails - } - }; - - // Function to build Leantime URL from project ID - // If leantimeProjectId is a URL, convert it; if it's just an ID, build the URL - const getLeantimeUrl = (projectId: string | null | undefined): string | null => { - if (!projectId) return null; - - // If it's already a full URL, convert it - if (projectId.startsWith('http://') || projectId.startsWith('https://')) { - return convertToIframeUrl(projectId); - } - - // Otherwise, it's just an ID - build the full URL - // Format: agilite.slm-lab.net/projects/showProject/[id] - const appUrl = `https://agilite.slm-lab.net/projects/showProject/${projectId}`; - return convertToIframeUrl(appUrl); - }; // Handle delete mission const handleDeleteMission = async () => { @@ -626,97 +573,77 @@ export default function MissionDetailPage() { )} - {/* Liens d'intégration */} + {/* Ressources Métiers */} {(mission.rocketChatChannelId || mission.outlineCollectionId || mission.giteaRepositoryUrl || mission.leantimeProjectId) && (
-

Liens d'intégration

+

Ressources Métiers

{mission.rocketChatChannelId && ( -
-
-
- -
-
-

Tenant de Parole

-

RocketChat

-
+ +
+
-
- Ouvrir - -
+
+

Espace de discussion

+

RocketChat

+
+ )} {mission.outlineCollectionId && ( -
-
-
- -
-
-

Tenant du Chapitre

-

Outline

-
+ +
+
-
- Ouvrir - -
+
+

Espace de documentation

+

Outline

+
+ )} {mission.giteaRepositoryUrl && ( -
-
-
- -
-
-

Tenant du Code

-

Gitea

-
+ +
+
-
- Ouvrir - -
+
+

Espace pour les codes sources

+

Gitea

+
+ )} {mission.leantimeProjectId && ( -
-
-
- -
-
-

Tenant des Devoirs

-

Leantime

-
+ +
+
-
- Ouvrir - -
+
+

Espace d'organisation

+

Leantime

+
+ )}