@@ -16,9 +16,6 @@ export class OrgsList extends LiteElement {
1616  @property ( {  type : Array  } ) 
1717  orgList ?: OrgData [ ]  =  [ ] ; 
1818
19-   @property ( {  type : Object  } ) 
20-   defaultOrg ?: UserOrg ; 
21- 
2219  @property ( {  type : Boolean  } ) 
2320  skeleton ? =  false ; 
2421
@@ -30,9 +27,12 @@ export class OrgsList extends LiteElement {
3027      return  this . renderSkeleton ( ) ; 
3128    } 
3229
30+     const  defaultOrg  =  this . userInfo ?. orgs . find ( ( org )  =>  org . default  ===  true ) ; 
31+ 
3332    return  html ` 
3433      < ul  class ="overflow-hidden rounded-lg border ">  
35-         ${ this . orgList ?. map ( this . renderOrg ) } ${ this . renderOrgQuotas ( ) }  
34+         ${ this . orgList ?. map ( this . renderOrg ( defaultOrg ) ) }  
35+         ${ this . renderOrgQuotas ( ) }  
3636      </ ul >  
3737    ` ; 
3838  } 
@@ -125,9 +125,16 @@ export class OrgsList extends LiteElement {
125125    return  stop ; 
126126  } 
127127
128-   private  readonly  renderOrg  =  ( org : OrgData )  =>  { 
128+   private  readonly  renderOrg  =  ( defaultOrg ?: UserOrg )  =>  ( org : OrgData )  =>  { 
129+     if  ( ! this . userInfo )  return ; 
130+ 
131+     // There shouldn't really be a case where an org is in the org list but 
132+     // not in user info, but disable clicking into the org just in case 
133+     const  isUserOrg  =  this . userInfo . orgs . some ( ( {  id } )  =>  id  ===  org . id ) ; 
134+ 
129135    let  defaultLabel : TemplateResult  |  undefined ; 
130-     if  ( this . defaultOrg  &&  org . id  ===  this . defaultOrg . id )  { 
136+ 
137+     if  ( defaultOrg  &&  org . id  ===  defaultOrg . id )  { 
131138      defaultLabel  =  html `< sl-tag  size ="small " variant ="primary " class ="mr-2 " 
132139        > ${ msg ( "Default" ) } </ sl-tag  
133140      > ` ; 
@@ -136,9 +143,12 @@ export class OrgsList extends LiteElement {
136143
137144    return  html ` 
138145      < li  
139-         class ="flex items-center justify-between border-t bg-white p-3 text-primary first:border-t-0 hover:text-indigo-400 " 
146+         class ="${ isUserOrg  
147+           ? ""  
148+           : "select-none cursor-not-allowed opacity-50" }   flex items-center justify-between border-t bg-white p-3 text-primary first:border-t-0 hover:text-indigo-400 "
140149        role ="button " 
141150        @click =${ this . makeOnOrgClick ( org ) }  
151+         aria-disabled ="${ isUserOrg }  
142152      >  
143153        < div  class ="mr-2 font-medium transition-colors ">  
144154          ${ defaultLabel } ${ org . name }  
0 commit comments