Skip to content

Commit 1fa5f87

Browse files
author
Ivelin Ivanov
authored
fix: polish UI. Event page view. Add status snackbar close button. (#785)
Signed-off-by: ivelin <[email protected]>
1 parent 9e9c7de commit 1fa5f87

File tree

8 files changed

+86
-60
lines changed

8 files changed

+86
-60
lines changed

.github/workflows/issue-cleanup.yml

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: 'Lock Threads'
2+
3+
on:
4+
schedule:
5+
- cron: '0 0 * * *'
6+
workflow_dispatch:
7+
8+
permissions:
9+
issues: write
10+
pull-requests: write
11+
12+
concurrency:
13+
group: lock
14+
15+
jobs:
16+
action:
17+
runs-on: ubuntu-latest
18+
steps:
19+
- uses: dessant/lock-threads@v3

.github/workflows/lighthouse.yml

+7-5
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,11 @@
22

33
name: Lighthouse PWA CI
44

5-
# Controls when the action will run. Triggers the workflow on push or pull request
6-
# events but only for the master branch
7-
on: [pull_request]
5+
on:
6+
# Netlify pre-deploy only works on pull_request
7+
pull_request:
8+
# branches:
9+
# - master
810

911
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
1012
jobs:
@@ -17,11 +19,11 @@ jobs:
1719
steps:
1820
- uses: actions/checkout@v2
1921
- name: Wait for Netlify preview deployment of this git branch
22+
if: github.repository_owner == 'ambianic'
2023
uses: jakepartusch/wait-for-netlify-action@v1
2124
id: get-netlify-url
2225
with:
2326
site_name: "ambianic-pwa-dist"
24-
max_timeout: 180
2527
- name: Run Lighthouse PWA check against Netlify PR Preview
2628
uses: treosh/lighthouse-ci-action@v8
2729
with:
@@ -31,7 +33,7 @@ jobs:
3133
temporaryPublicStorage: true # upload lighthouse report to the temporary storage
3234
# budgetPath: '.github/lighthouse/budget.json' # performance budgets
3335
configPath: '.github/lighthouse/lighthouserc-netlify-preview.json' # PWA checks
34-
- name: Run Lighthouse PWA sanity check against Netlify production deployment
36+
- name: Run Lighthouse PWA sanity check against the existing Netlify production deployment
3537
uses: treosh/lighthouse-ci-action@v8
3638
with:
3739
urls: |

.github/workflows/main.yml

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
name: CI for Ambianic UI
22

33
on:
4-
# Trigger the workflow on push or pull request,
5-
# but only for the master branch
4+
# Trigger the workflow on push and pull requests
65
push:
76
# branches:
87
# - master

package-lock.json

+15-15
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@
7575
"husky": "^7.0.2",
7676
"istanbul-lib-coverage": "^3.0.0",
7777
"jest": "^26.0.1",
78-
"jest-extended": "^1.1.0",
78+
"jest-extended": "^1.2.0",
7979
"jest-fetch-mock": "^3.0.3",
8080
"lodash": "^4.17.21",
8181
"nyc": "^15.0.1",

src/components/shared/StatusSnackbar.vue

+4-5
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,12 @@
1111
<template #action="{ attrs }">
1212
<div
1313
v-bind="attrs"
14-
id="close-icon"
14+
ref="close-btn"
1515
@click="handleClose"
1616
>
17-
<Button
18-
icon="close"
19-
color="white"
20-
/>
17+
<v-btn>
18+
Close
19+
</v-btn>
2120
</div>
2221
</template>
2322
</v-snackbar>

src/views/Event.vue

+28-20
Original file line numberDiff line numberDiff line change
@@ -24,29 +24,37 @@
2424
</v-col>
2525
</v-row>
2626
<v-row
27-
align="center"
27+
align="start"
2828
justify="center"
29-
class="ma-5 pa-5"
29+
dense
3030
>
31-
<v-card class="text-center">
32-
<event-card
33-
v-if="isEdgeConnected"
34-
:data="eventData"
35-
ref="event-card"
36-
/>
37-
<v-card-text
38-
ref="loading-card"
39-
v-else
40-
>
41-
<p>
42-
Loading event info...
43-
</p>
44-
<v-progress-circular
45-
size="50"
46-
indeterminate
31+
<v-col
32+
:style="maxWidth"
33+
align="center"
34+
justify="center"
35+
cols="12"
36+
class="pa-0 ma-0 fill-height"
37+
>
38+
<v-card class="text-center">
39+
<event-card
40+
v-if="isEdgeConnected"
41+
:data="eventData"
42+
ref="event-card"
4743
/>
48-
</v-card-text>
49-
</v-card>
44+
<v-card-text
45+
ref="loading-card"
46+
v-else
47+
>
48+
<p>
49+
Loading event info...
50+
</p>
51+
<v-progress-circular
52+
size="50"
53+
indeterminate
54+
/>
55+
</v-card-text>
56+
</v-card>
57+
</v-col>
5058
</v-row>
5159
</amb-app-frame>
5260
</template>

tests/unit/components/shared/StatusSnackbar.spec.js

+11-12
Original file line numberDiff line numberDiff line change
@@ -36,20 +36,22 @@ describe('Snack Notification Component', () => {
3636
wrapper.destroy()
3737
})
3838

39-
it('It should contain a `p` element and close icon', () => {
39+
it('It should contain a `p` element and close icon', async () => {
40+
await Vue.nextTick()
4041
expect(wrapper.find('#snack-message').exists()).toBeTruthy()
41-
expect(wrapper.find('#close-icon').exists()).toBeTruthy()
42+
expect(wrapper.findComponent({ ref: 'close-btn' }).exists()).toBeTrue()
43+
expect(wrapper.findComponent({ ref: 'close-btn' }).text()).toEqual('Close')
4244
})
4345

44-
it('Displayed text changes with `peerConnectionStatus` state', () => {
46+
it('Displayed text changes with `peerConnectionStatus` state', async () => {
4547
store.state.pnp.peerConnectionStatus = PEER_CONNECTING
4648
const connectingComp = mount(StatusSnackbar, {
4749
localVue,
4850
vuetify,
4951
store
5052
})
53+
await Vue.nextTick()
5154
expect(connectingComp.find('#snack-message').text()).toBe(PEER_CONNECTING_NOTIFICATION)
52-
5355
store.state.pnp.peerConnectionStatus = PEER_CONNECTED
5456
const connectedComp = mount(StatusSnackbar, {
5557
localVue,
@@ -65,17 +67,14 @@ describe('Snack Notification Component', () => {
6567
store
6668
})
6769
expect(disconnectedComp.find('#snack-message').text()).toBe(PEER_DISCONNECTED_NOTIFICATION)
70+
expect(wrapper.findComponent({ ref: 'close-btn' }).exists()).toBeTrue()
71+
expect(wrapper.findComponent({ ref: 'close-btn' }).text()).toEqual('Close')
6872
})
6973

70-
it('`peerConnectionStatus` status controls StatusSnackbar visibility', () => {
74+
it('`peerConnectionStatus` status controls StatusSnackbar visibility', async () => {
7175
store.state.pnp.peerConnectionStatus = PEER_CONNECTED
7276

73-
const newComponent = mount(StatusSnackbar, {
74-
localVue,
75-
vuetify,
76-
store
77-
})
78-
79-
expect(newComponent.find('#snack-message').exists()).toBeTruthy()
77+
expect(wrapper.findComponent({ ref: 'close-btn' }).exists()).toBeTrue()
78+
expect(wrapper.findComponent({ ref: 'close-btn' }).text()).toEqual('Close')
8079
})
8180
})

0 commit comments

Comments
 (0)