Skip to content

Commit e0dbc60

Browse files
Red-GiulianoRed Giuliano
andauthored
fix(ui): pinned alerts below app bar and propagated connection status to footer (#424)
Co-authored-by: Red Giuliano <red.giuliano@zero-true.com>
1 parent fd783d7 commit e0dbc60

1 file changed

Lines changed: 102 additions & 39 deletions

File tree

zt_frontend/src/App.vue

Lines changed: 102 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,27 @@
127127
</v-icon>
128128
</v-btn>
129129
</v-app-bar>
130+
<div class="fixed-error">
131+
<transition name="fade">
132+
<v-alert
133+
v-if="errorMessage"
134+
type="error"
135+
dismissible
136+
class="mb-2"
137+
>
138+
{{ errorMessage }}
139+
</v-alert>
140+
</transition>
141+
<transition name="fade">
142+
<v-alert
143+
v-if="socketsDisconnected"
144+
type="error"
145+
dismissible
146+
>
147+
Connection to the server has been lost. Please refresh the page.
148+
</v-alert>
149+
</transition>
150+
</div>
130151
<v-navigation-drawer
131152
v-if="$devMode && !isMobile && !isAppRoute"
132153
:rail="true"
@@ -200,16 +221,6 @@
200221
style="padding-top: 12px; padding-bottom: 12px"
201222
/>
202223
<v-main :scrollable="false" class="w-100 mx-auto">
203-
<v-container v-if="errorMessage">
204-
<v-alert type="error">
205-
{{ errorMessage }}
206-
</v-alert>
207-
</v-container>
208-
<v-container v-if="socketsDisconnected">
209-
<v-alert type="error">
210-
Connection to the server has been lost. Please refresh the page.
211-
</v-alert>
212-
</v-container>
213224
<div :class="['content', 'px-8', 'd-flex', 'justify-center']">
214225
<div class="content__cells flex-grow-1" transition="slide-x-transition">
215226
<CodeCellManager
@@ -290,36 +301,37 @@
290301
</div>
291302

292303
<div class="footer__status-wrapper">
293-
<!-- <span>
294-
<v-icon
295-
:icon="`ztIcon:${ztAliases.clock}`"
296-
/>
297-
Saved 5mins ago
298-
</span> -->
299-
<!-- <v-icon class="dot-divider" :icon="`ztIcon:${ztAliases.dot}`"/> -->
300-
<div v-if="isCodeRunning" class="footer__status">
301-
<v-icon :icon="`ztIcon:${ztAliases.status}`" />
302-
<span>Running</span>
303-
</div>
304-
<div
305-
v-if="!isCodeRunning"
306-
class="footer__status footer__status--connected"
307-
>
308-
<v-icon :icon="`ztIcon:${ztAliases.status}`" />
309-
<span>Connected</span>
310-
</div>
311-
<v-btn
312-
v-if="isCodeRunning"
313-
density="comfortable"
314-
:icon="`ztIcon:${ztAliases.stop}`"
315-
variant="plain"
316-
:ripple="false"
317-
@click="stopCodeExecution()"
318-
rounded
319-
class="stop-btn"
320-
>
321-
</v-btn>
304+
<!-- Running Status -->
305+
<div v-if="isCodeRunning" class="footer__status footer__status--running">
306+
<v-icon :icon="`ztIcon:${ztAliases.status}`" />
307+
<span>Running</span>
308+
</div>
309+
310+
<!-- Disconnected Status -->
311+
<div v-else-if="socketsDisconnected" class="footer__status footer__status--disconnected">
312+
<v-icon :icon="`ztIcon:${ztAliases.status}`" />
313+
<span>Disconnected</span>
322314
</div>
315+
316+
<!-- Connected Status -->
317+
<div v-else class="footer__status footer__status--connected">
318+
<v-icon :icon="`ztIcon:${ztAliases.status}`" />
319+
<span>Connected</span>
320+
</div>
321+
322+
<!-- Stop Button -->
323+
<v-btn
324+
v-if="isCodeRunning"
325+
density="comfortable"
326+
:icon="`ztIcon:${ztAliases.stop}`"
327+
variant="plain"
328+
:ripple="false"
329+
@click="stopCodeExecution()"
330+
rounded
331+
class="stop-btn"
332+
>
333+
</v-btn>
334+
</div>
323335
</div>
324336
</v-footer>
325337
</v-app>
@@ -1345,6 +1357,57 @@ export default {
13451357
color: var(--v-theme-on-primary) !important;
13461358
}
13471359
1360+
/* Fixed Error Messages Styling */
1361+
.fixed-error {
1362+
position: fixed;
1363+
top: 60px; /* 51px app bar height + 9px spacing */
1364+
left: 50%;
1365+
transform: translateX(-50%);
1366+
width: 90%;
1367+
max-width: 600px;
1368+
z-index: 1000; /* Ensure it appears above other elements */
1369+
}
1370+
1371+
.footer__status-wrapper {
1372+
display: flex;
1373+
align-items: center;
1374+
gap: 8px; /* Adds space between icon and text */
1375+
}
1376+
1377+
.footer__status {
1378+
display: flex;
1379+
align-items: center;
1380+
font-weight: bold;
1381+
}
1382+
1383+
/* Running Status */
1384+
.footer__status--running {
1385+
color: rgba(var(--v-theme-success)); /* Green color for running */
1386+
}
1387+
1388+
/* Disconnected Status */
1389+
.footer__status--disconnected {
1390+
color: rgba(var(--v-theme-error)); /* Red color for disconnected */
1391+
}
1392+
1393+
/* Connected Status */
1394+
.footer__status--connected {
1395+
color: rgba(var(--v-theme-info)); /* Blue color for connected */
1396+
}
1397+
1398+
/* Optional: Style the Icons Differently Based on Status */
1399+
.footer__status--running v-icon {
1400+
color: rgba(var(--v-theme-success));
1401+
}
1402+
1403+
.footer__status--disconnected v-icon {
1404+
color: rgba(var(--v-theme-error));
1405+
}
1406+
1407+
.footer__status--connected v-icon {
1408+
color: rgba(var(--v-theme-info));
1409+
}
1410+
13481411
.toggle-group {
13491412
display: flex;
13501413
justify-content: center;

0 commit comments

Comments
 (0)