@@ -3,7 +3,16 @@ import React, {useEffect, useState} from "react";
33import { connectServiceProviderToIdentityProvider , publicServiceProviderByDetail } from "../api/index.js" ;
44import I18n from "../locale/I18n.js" ;
55import { useNavigate , useParams } from "react-router-dom" ;
6- import { Button , ButtonIconPlacement , ButtonType , Loader , RadioOptions , RadioOptionsOrientation } from "@surfnet/sds" ;
6+ import {
7+ Button ,
8+ ButtonIconPlacement ,
9+ ButtonType ,
10+ Chip ,
11+ ChipType ,
12+ Loader ,
13+ RadioOptions ,
14+ RadioOptionsOrientation
15+ } from "@surfnet/sds" ;
716import StudentPng from "../icons/student2.png" ;
817import PlaceHolderImage from "@surfnet/sds/icons/placeholder-image.svg" ;
918import ArrowLeftIcon from "@surfnet/sds/icons/functional-icons/arrow-left-2.svg" ;
@@ -21,6 +30,7 @@ import ConfirmationDialog from "../components/ConfirmationDialog.jsx";
2130import { authorities } from "../utils/Permissions.js" ;
2231import InputField from "../components/InputField.jsx" ;
2332import { mainMenuItems } from "../utils/MenuItems.js" ;
33+ import { TabHeader } from "../components/TabHeader.jsx" ;
2434
2535const confirmationModalOptions = {
2636 makeConnection : "makeConnection" ,
@@ -30,7 +40,9 @@ const confirmationModalOptions = {
3040 requestDisconnectConnection : "requestDisconnectConnection" ,
3141}
3242
33- const ApplicationDetail = ( { anonymous} ) => {
43+ const tabNames = [ "access" , "information" ]
44+
45+ const ApplicationDetail = ( { anonymous, refreshUser} ) => {
3446
3547 const { arp, privacy, user, setFlash} = useAppStore ( useShallow ( state => ( {
3648 arp : state . arp ,
@@ -40,8 +52,10 @@ const ApplicationDetail = ({anonymous}) => {
4052 } ) ) ) ;
4153
4254 const navigate = useNavigate ( ) ;
43- const { manageType, manageId} = useParams ( ) ;
55+ const [ refresh , setRefresh ] = useState ( - 1 ) ;
56+ const { manageType, manageId, tab = "access" } = useParams ( ) ;
4457
58+ const [ currentTab , setCurrentTab ] = useState ( tab ) ;
4559 const [ loading , setLoading ] = useState ( true ) ;
4660 const [ serviceProvider , setServiceProvider ] = useState ( [ ] ) ;
4761 const [ showAttributes , setShowAttributes ] = useState ( false ) ;
@@ -83,7 +97,7 @@ const ApplicationDetail = ({anonymous}) => {
8397 breadcrumbPaths : [
8498 { path : "/home" , value : I18n . t ( "breadCrumb.access" ) , menuItemName : mainMenuItems . home } ,
8599 {
86- path : isAccessible ? "/accessibleApps " : "/catalogue" ,
100+ path : isAccessible ? "/accessible-apps " : "/catalogue" ,
87101 value : I18n . t ( `navigation.${ isAccessible ? "accessibleApps" : "catalogue" } ` )
88102 } ,
89103 { value : providerName ( I18n . locale , res ) }
@@ -101,7 +115,7 @@ const ApplicationDetail = ({anonymous}) => {
101115 . catch ( ( ) => {
102116 navigate ( "/404" ) ;
103117 } ) ;
104- } , [ user ] ) ; // eslint-disable-line react-hooks/exhaustive-deps
118+ } , [ user , refresh ] ) ; // eslint-disable-line react-hooks/exhaustive-deps
105119
106120 if ( loading ) {
107121 return < Loader />
@@ -238,10 +252,52 @@ const ApplicationDetail = ({anonymous}) => {
238252
239253 const { open, cancel, action, question, title, okButton} = confirmation ;
240254
255+ const renderCurrentTab = ( ) => {
256+ switch ( currentTab ) {
257+ case "access" : {
258+ return renderAccessApp ( ) ;
259+ }
260+ case "information" : {
261+ return < span > TODO</ span > ;
262+ }
263+ default :
264+ throw new Error ( `Unknown tab; ${ currentTab } ` )
265+ }
266+ }
267+
268+ const tabChanged = name => {
269+ setCurrentTab ( name ) ;
270+ }
271+
272+ const renderAccessApp = ( ) => {
273+ return < span > TODO renderAccessApp</ span > ;
274+ }
275+
241276 const renderAccessibleApp = ( ) => {
242277 return (
243278 < >
244- < p > readOnly { readOnly . toString ( ) } </ p >
279+ < div className = "application-detail-header-container" >
280+ < TabHeader tab = { currentTab }
281+ setTab = { tabChanged }
282+ tabNames = { tabNames }
283+ >
284+ < div className = "application-card-container" >
285+ < div className = "application-card" >
286+ { metaData [ "logo:0:url" ] && < img src = { metaData [ "logo:0:url" ] } alt = "" /> }
287+ { ! metaData [ "logo:0:url" ] && < PlaceHolderImage /> }
288+ < div className = "provider-details" >
289+ < h3 > { providerName ( I18n . locale , serviceProvider ) } </ h3 >
290+ < p > { providerDescription ( I18n . locale , serviceProvider ) } </ p >
291+ </ div >
292+ </ div >
293+ < Chip type = { readOnly ? ChipType . Status_error : ChipType . Status_info }
294+ label = { I18n . t ( `accessibleApps.${ readOnly ? "connectRequested" : "connectionMade" } ` ) } />
295+ </ div >
296+ </ TabHeader >
297+ </ div >
298+ < div className = "application-detail-page" >
299+ { renderCurrentTab ( ) }
300+ </ div >
245301 </ >
246302 )
247303 }
0 commit comments