11import './style.scss' ;
22import { useQuery } from '@tanstack/react-query' ;
3- import { type RouterState , useNavigate , useRouterState } from '@tanstack/react-router' ;
3+ import {
4+ type RouterState ,
5+ useLoaderData ,
6+ useNavigate ,
7+ useRouterState ,
8+ } from '@tanstack/react-router' ;
49import { useMemo , useState } from 'react' ;
510import { m } from '../../paraglide/messages' ;
611import { AppleHelpModal } from '../../shared/components/AppleHelpModal/AppleHelpModal' ;
@@ -12,6 +17,7 @@ import { Button } from '../../shared/defguard-ui/components/Button/Button';
1217import { ButtonMenu } from '../../shared/defguard-ui/components/ButtonMenu/MenuButton' ;
1318import { Icon } from '../../shared/defguard-ui/components/Icon' ;
1419import type { IconKindValue } from '../../shared/defguard-ui/components/Icon/icon-types' ;
20+ import { InfoBanner } from '../../shared/defguard-ui/components/InfoBanner/InfoBanner' ;
1521import type { MenuItemsGroup } from '../../shared/defguard-ui/components/Menu/types' ;
1622import { Modal } from '../../shared/defguard-ui/components/Modal/Modal' ;
1723import { ModalControls } from '../../shared/defguard-ui/components/ModalControls/ModalControls' ;
@@ -23,10 +29,14 @@ import { openVirtualLink } from '../../shared/utils/openVirtualLink';
2329import androidIcon from './assets/android.png' ;
2430import iosIcon from './assets/ios.png' ;
2531import laptopIcon from './assets/laptop.png' ;
32+ import linuxIcon from './assets/linux.png' ;
2633import desktopIcon from './assets/pc-tower.png' ;
2734
2835export const ClientDownloadPage = ( ) => {
2936 const { data : pageData } = useQuery ( getClientArtifactsQueryOptions ) ;
37+ const { enrollmentState } = useLoaderData ( {
38+ from : '/download' ,
39+ } ) ;
3040 const routerLoading = useRouterState ( { select : ( s : RouterState ) => s . isLoading } ) ;
3141
3242 const navigate = useNavigate ( ) ;
@@ -58,44 +68,71 @@ export const ClientDownloadPage = () => {
5868 [ pageData ] ,
5969 ) ;
6070
61- const linuxMenu : MenuItemsGroup [ ] = useMemo (
62- ( ) => [
71+ const linuxMenu : MenuItemsGroup [ ] = useMemo ( ( ) => {
72+ const res : MenuItemsGroup [ ] = [
6373 {
6474 items : [
6575 {
66- text : 'Deb X86' ,
76+ icon : 'ubuntu' ,
77+ text : 'Ubuntu 24.04 ARM' ,
78+ onClick : ( ) => openVirtualLink ( pageData ?. deb_arm64 ) ,
79+ } ,
80+ {
81+ icon : 'ubuntu' ,
82+ text : 'Ubuntu 24.04 AMD64' ,
6783 onClick : ( ) => openVirtualLink ( pageData ?. deb_amd64 ) ,
6884 } ,
85+ ] ,
86+ } ,
87+ {
88+ items : [
6989 {
70- text : 'Deb ARM' ,
90+ icon : 'debian' ,
91+ text : 'Ubuntu 22.04 / Debian 12&13 ARM' ,
7192 onClick : ( ) => openVirtualLink ( pageData ?. deb_arm64 ) ,
7293 } ,
7394 {
74- text : 'RPM X86' ,
75- onClick : ( ) => openVirtualLink ( pageData ?. rpm_amd64 ) ,
95+ icon : 'debian' ,
96+ text : 'Ubuntu 22.04 / Debian 12&13 AMD64' ,
97+ onClick : ( ) => openVirtualLink ( pageData ?. deb_amd64 ) ,
7698 } ,
99+ ] ,
100+ } ,
101+ {
102+ items : [
77103 {
104+ icon : 'linux' ,
78105 text : 'RPM ARM' ,
79106 onClick : ( ) => openVirtualLink ( pageData ?. rpm_arm64 ) ,
80107 } ,
81108 {
109+ icon : 'linux' ,
110+ text : 'RPM AMD64' ,
111+ onClick : ( ) => openVirtualLink ( pageData ?. rpm_amd64 ) ,
112+ } ,
113+ ] ,
114+ } ,
115+ {
116+ items : [
117+ {
118+ icon : 'arch-linux' ,
82119 text : 'Arch Linux' ,
83120 onClick : ( ) => openVirtualLink ( externalLink . client . desktop . linux . arch ) ,
84121 } ,
85122 ] ,
86123 } ,
87- ] ,
88- [ pageData ] ,
89- ) ;
124+ ] ;
125+ return res ;
126+ } , [ pageData ] ) ;
90127
91128 return (
92129 < Page id = "client-download-page" nav >
93- < EnrollmentStep current = { 0 } max = { 2 } />
130+ < EnrollmentStep current = { 1 } max = { 2 } />
94131 < header >
95132 < h1 > { m . client_download_title ( ) } </ h1 >
96133 < p > { m . client_download_subtitle ( ) } </ p >
97134 </ header >
98- < SizedBox height = { ThemeSpacing . Xl4 } />
135+ < SizedBox height = { ThemeSpacing . Xl3 } />
99136 < div className = "platforms" >
100137 < div className = "label" >
101138 < Icon icon = "desktop" size = { 20 } /> < p > { m . client_download_label_desktop ( ) } </ p >
@@ -121,7 +158,7 @@ export const ClientDownloadPage = () => {
121158 buttonText = { m . client_download_for ( { platform : 'Linux' } ) }
122159 buttonIconKind = "linux"
123160 menuItems = { linuxMenu }
124- icon = { desktopIcon }
161+ icon = { linuxIcon }
125162 />
126163 < Platform
127164 testId = "macos"
@@ -136,33 +173,42 @@ export const ClientDownloadPage = () => {
136173 />
137174 </ div >
138175 < SizedBox height = { ThemeSpacing . Xl3 } />
139- < div className = "platforms" >
140- < div className = "label" >
141- < Icon icon = "mobile" size = { 20 } /> < p > { m . client_download_label_mobile ( ) } </ p >
176+ { enrollmentState . enrollmentData . user . enrolled && (
177+ < div className = "platforms" >
178+ < div className = "label" >
179+ < Icon icon = "mobile" size = { 20 } /> < p > { m . client_download_label_mobile ( ) } </ p >
180+ </ div >
181+ < Platform
182+ testId = "android"
183+ title = { m . client_download_for ( { platform : 'Android' } ) }
184+ subtitle = { m . client_download_supports_newer ( {
185+ platform : 'Android 12.0 (Snow Cone)' ,
186+ } ) }
187+ buttonText = { m . client_download_for ( { platform : 'Android' } ) }
188+ buttonIconKind = "android"
189+ directLink = { externalLink . client . mobile . google }
190+ icon = { androidIcon }
191+ />
192+ < Platform
193+ testId = "iOS"
194+ title = { m . client_download_for ( { platform : 'iOS' } ) }
195+ subtitle = { m . client_download_supports_newer ( {
196+ platform : 'iOS 15+' ,
197+ } ) }
198+ buttonText = { m . client_download_for ( { platform : 'iOS' } ) }
199+ buttonIconKind = "apple"
200+ directLink = { externalLink . client . mobile . apple }
201+ icon = { iosIcon }
202+ />
142203 </ div >
143- < Platform
144- testId = "android"
145- title = { m . client_download_for ( { platform : 'Android' } ) }
146- subtitle = { m . client_download_supports_newer ( {
147- platform : 'Android 12.0 (Snow Cone)' ,
148- } ) }
149- buttonText = { m . client_download_for ( { platform : 'Android' } ) }
150- buttonIconKind = "android"
151- directLink = { externalLink . client . mobile . google }
152- icon = { androidIcon }
153- />
154- < Platform
155- testId = "iOS"
156- title = { m . client_download_for ( { platform : 'iOS' } ) }
157- subtitle = { m . client_download_supports_newer ( {
158- platform : 'iOS 15+' ,
159- } ) }
160- buttonText = { m . client_download_for ( { platform : 'iOS' } ) }
161- buttonIconKind = "apple"
162- directLink = { externalLink . client . mobile . apple }
163- icon = { iosIcon }
204+ ) }
205+ { ! enrollmentState . enrollmentData . user . enrolled && (
206+ < InfoBanner
207+ variant = "warning"
208+ icon = "warning"
209+ text = { m . client_download_mobile_warning ( ) }
164210 />
165- </ div >
211+ ) }
166212 < AppleHelpModal
167213 isOpen = { appleHelpModalOpen }
168214 onClose = { ( ) => {
@@ -194,21 +240,14 @@ export const ClientDownloadPage = () => {
194240 loading : routerLoading ,
195241 onClick : ( ) => {
196242 navigate ( {
197- to : '/enrollment-start ' ,
243+ to : '/client-setup ' ,
198244 replace : true ,
199245 } ) ;
200246 } ,
201247 } }
202248 />
203249 </ Modal >
204250 < PageNavigation
205- backText = { m . controls_back ( ) }
206- onBack = { ( ) => {
207- navigate ( {
208- to : '/' ,
209- replace : true ,
210- } ) ;
211- } }
212251 nextText = { m . controls_continue ( ) }
213252 onNext = { ( ) => {
214253 setConfirmModalOpen ( true ) ;
0 commit comments