|
12 | 12 | </style> |
13 | 13 |
|
14 | 14 | <script lang="ts"> |
15 | | - import { state } from '../script/stores/uiStore'; |
| 15 | + import { |
| 16 | + compatibility, |
| 17 | + isCompatibilityWarningDialogOpen, |
| 18 | + state, |
| 19 | + } from '../script/stores/uiStore'; |
16 | 20 | import trainModelImage from '../imgs/TrainModel.svg'; |
17 | 21 | import inputDataImage from '../imgs/InputData.svg'; |
18 | 22 | import testModelImage from '../imgs/TestModel.svg'; |
|
25 | 29 | } from '../components/HtmlFormattedMessage.svelte'; |
26 | 30 | import LinkOverlayContainer from '../components/LinkOverlayContainer.svelte'; |
27 | 31 | import LinkOverlay from '../components/LinkOverlay.svelte'; |
28 | | - import { Paths, currentPath, getTitle, navigate } from '../router/paths'; |
| 32 | + import { Paths, getTitle, navigate } from '../router/paths'; |
29 | 33 | import { gestures } from '../script/stores/Stores'; |
| 34 | + import CompatibilityWarningDialog from '../components/CompatibilityWarningDialog.svelte'; |
30 | 35 | import StandardDialog from '../components/dialogs/StandardDialog.svelte'; |
31 | 36 | import { clearGestures } from '../script/stores/mlStore'; |
32 | 37 | import { get } from 'svelte/store'; |
|
44 | 49 | $: hasExistingSession = $gestures.some(g => g.name || g.recordings.length); |
45 | 50 | let showDataLossWarning = false; |
46 | 51 |
|
47 | | - const checkForExistingSession = () => { |
| 52 | + const { bluetooth, usb } = get(compatibility); |
| 53 | + const isIncompatible = !bluetooth && !usb; |
| 54 | +
|
| 55 | + const openCompatibityWarningDialog = () => isCompatibilityWarningDialogOpen.set(true); |
| 56 | +
|
| 57 | + const onClickStartNewSession = () => { |
| 58 | + if (isIncompatible) { |
| 59 | + openCompatibityWarningDialog(); |
| 60 | + return; |
| 61 | + } |
48 | 62 | if (hasExistingSession) { |
49 | 63 | showDataLossWarning = true; |
50 | 64 | } else { |
|
103 | 117 | <div class="grid grid-cols-1 lg:grid-cols-3 p-10 gap-5"> |
104 | 118 | <LinkOverlayContainer> |
105 | 119 | <FrontPageContentTile> |
106 | | - <LinkOverlay path={Paths.DATA} class="mb-5"> |
| 120 | + <LinkOverlay |
| 121 | + onClickOrHrefOrPath={isIncompatible |
| 122 | + ? openCompatibityWarningDialog |
| 123 | + : Paths.DATA} |
| 124 | + class="mb-5"> |
107 | 125 | <h3 class="text-center text-2xl font-bold"> |
108 | 126 | {$t('content.index.toolProcessCards.data.title')} |
109 | 127 | </h3> |
|
117 | 135 |
|
118 | 136 | <LinkOverlayContainer> |
119 | 137 | <FrontPageContentTile> |
120 | | - <LinkOverlay path={Paths.TRAINING} class="mb-5"> |
| 138 | + <LinkOverlay |
| 139 | + onClickOrHrefOrPath={isIncompatible |
| 140 | + ? openCompatibityWarningDialog |
| 141 | + : Paths.TRAINING} |
| 142 | + class="mb-5"> |
121 | 143 | <h3 class="text-center text-2xl font-bold"> |
122 | 144 | {$t('content.index.toolProcessCards.train.title')} |
123 | 145 | </h3> |
|
131 | 153 |
|
132 | 154 | <LinkOverlayContainer> |
133 | 155 | <FrontPageContentTile> |
134 | | - <LinkOverlay path={Paths.MODEL} class="mb-5"> |
| 156 | + <LinkOverlay |
| 157 | + onClickOrHrefOrPath={isIncompatible |
| 158 | + ? openCompatibityWarningDialog |
| 159 | + : Paths.MODEL} |
| 160 | + class="mb-5"> |
135 | 161 | <h3 class="text-center text-2xl font-bold"> |
136 | 162 | {$t('content.index.toolProcessCards.model.title')} |
137 | 163 | </h3> |
|
153 | 179 | <StandardButton |
154 | 180 | size="large" |
155 | 181 | type={hasExistingSession ? 'secondary' : 'primary'} |
156 | | - onClick={checkForExistingSession}>{$t('footer.start')}</StandardButton> |
| 182 | + onClick={onClickStartNewSession}>{$t('footer.start')}</StandardButton> |
157 | 183 | </div> |
158 | 184 | </div> |
159 | 185 | </main> |
|
0 commit comments