Skip to content

Commit a32a672

Browse files
committed
feat: pinned/fixed the top menu on Android
1 parent 0d66712 commit a32a672

File tree

4 files changed

+17
-15
lines changed

4 files changed

+17
-15
lines changed

src/components/Header.vue

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<template lang="pug">
2-
div.aw-navbar
3-
b-navbar(toggleable="lg")
2+
div(:class="{'fixed-top-padding': fixedTopMenu}")
3+
b-navbar.aw-navbar(toggleable="lg" :fixed="fixedTopMenu ? 'top' : null")
44
// Brand on mobile
55
b-navbar-nav.d-block.d-lg-none
66
b-navbar-brand(to="/" style="background-color: transparent;")
@@ -70,6 +70,12 @@ div.aw-navbar
7070
| Settings
7171
</template>
7272

73+
<style lang="scss" scoped>
74+
.fixed-top-padding {
75+
padding-bottom: 3.5em;
76+
}
77+
</style>
78+
7379
<script>
7480
// only import the icons you use to reduce bundle size
7581
import 'vue-awesome/icons/calendar-day';
@@ -92,6 +98,8 @@ export default {
9298
data() {
9399
return {
94100
activityViews: [],
101+
// Make configurable?
102+
fixedTopMenu: this.$isAndroid,
95103
};
96104
},
97105
mounted: async function () {

src/main.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,12 @@ Vue.component('aw-calendar', () => import('./visualizations/Calendar.vue'));
6565
Vue.mixin(require('~/mixins/asyncErrorCaptured.js'));
6666

6767
// Set the PRODUCTION constant
68+
// FIXME: Thould follow Vue convention and start with a $.
6869
Vue.prototype.PRODUCTION = PRODUCTION;
6970

71+
// Set the $isAndroid constant
72+
Vue.prototype.$isAndroid = process.env.VUE_APP_ON_ANDROID;
73+
7074
// Setup Vue app
7175
import App from './App';
7276
new Vue({

src/views/Home.vue

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
<template lang="pug">
22
div
3-
b-alert(v-if="isAndroid" show)
3+
b-alert(v-if="$isAndroid" show)
44
| #[b Note:] ActivityWatch on Android is in a very early stage of development. There will be bugs, but we hope you bear with us as we refine things and get it on par with the desktop version of ActivityWatch (which you should try!).
55

66
h3 Hello early user,
77
p
8-
| It's still early days for ActivityWatch #[span(v-if="isAndroid") (especially on Android!)]. We've come a long way but we need users (like you!)
8+
| It's still early days for ActivityWatch #[span(v-if="$isAndroid") (especially on Android!)]. We've come a long way but we need users (like you!)
99
| to provide feedback and help us turn ActivityWatch into a successful project.
1010
| Early users like you mean a lot to us, and we hope you'll reach out to us with any ideas you have for improvements!
1111
p
@@ -72,10 +72,5 @@ div
7272
<script>
7373
export default {
7474
name: 'Home',
75-
data() {
76-
return {
77-
isAndroid: process.env.VUE_APP_ON_ANDROID,
78-
};
79-
},
8075
};
8176
</script>

src/views/settings/Settings.vue

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ div
1818

1919
hr
2020

21-
div(v-if="!isAndroid")
21+
div(v-if="!$isAndroid")
2222
ReleaseNotificationSettings
2323
hr
2424

@@ -42,10 +42,5 @@ export default {
4242
CategorizationSettings,
4343
LandingPageSettings,
4444
},
45-
data() {
46-
return {
47-
isAndroid: process.env.VUE_APP_ON_ANDROID,
48-
};
49-
},
5045
};
5146
</script>

0 commit comments

Comments
 (0)