Skip to content

Commit a81c8c3

Browse files
fix: code review
Signed-off-by: Luka Trovic <luka@nextcloud.com>
1 parent fdc4c1b commit a81c8c3

6 files changed

Lines changed: 58 additions & 33 deletions

File tree

src/components/Editor.vue

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,12 +54,16 @@
5454
<MenuBar v-if="renderMenus"
5555
ref="menubar"
5656
:autohide="autohide"
57-
:loaded.sync="menubarLoaded">
57+
:loaded.sync="menubarLoaded"
58+
:relative-path="relativePath">
5859
<Status :document="document"
5960
:dirty="dirty"
6061
:sessions="filteredSessions"
6162
:sync-error="syncError"
62-
:has-connection-issue="hasConnectionIssue" />
63+
:has-connection-issue="hasConnectionIssue"
64+
:last-saved-string="lastSavedString" />
65+
<RightSideActions :relative-path="relativePath"
66+
:basename="basename" />
6367
<slot name="header" />
6468
</MenuBar>
6569
<div v-else class="menubar-placeholder" />

src/components/Editor/RightSideActions.vue

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,43 +5,43 @@
55
</div>
66
<a :download="basename"
77
:href="fullPathToFile">
8-
<Button class="download__button"
8+
<NcButton class="download__button"
99
type="primary">
1010
Download
11-
</Button>
11+
</NcButton>
1212
</a>
13-
<Actions>
14-
<ActionButton icon="icon-edit"
13+
<NcActions>
14+
<NcActionButton icon="icon-edit"
1515
:close-after-click="true"
1616
@click="showSidebar">
1717
Open sidebar
18-
</ActionButton>
19-
<ActionButton icon="icon-delete"
18+
</NcActionButton>
19+
<NcActionButton icon="icon-delete"
2020
:close-after-click="true"
2121
@click="onDelete">
2222
Delete
23-
</ActionButton>
24-
</Actions>
23+
</NcActionButton>
24+
</NcActions>
2525
</div>
2626
</template>
2727

2828
<script>
2929
3030
import axios from '@nextcloud/axios'
3131
import { getCurrentUser } from '@nextcloud/auth'
32-
import Actions from '@nextcloud/vue/dist/Components/Actions'
33-
import ActionButton from '@nextcloud/vue/dist/Components/ActionButton'
34-
import Button from '@nextcloud/vue/dist/Components/Button'
32+
import NcActions from '@nextcloud/vue/dist/Components/NcActions'
33+
import NcActionButton from '@nextcloud/vue/dist/Components/NcActionButton'
34+
import NcButton from '@nextcloud/vue/dist/Components/NcButton'
3535
import { getRootPath } from '../../helpers/files.js'
3636
import { getAvatarUrl } from '../../helpers'
3737
3838
export default {
3939
name: 'RightSideActions',
4040
4141
components: {
42-
Actions,
43-
ActionButton,
44-
Button,
42+
NcActions,
43+
NcActionButton,
44+
NcButton,
4545
},
4646
4747
props: {

src/components/Editor/Status.vue

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,8 +141,26 @@ export default {
141141
}
142142
143143
.save-status {
144-
border-radius: 50%;
145-
color: var(--color-text-lighter);
144+
--color-text-white: white;
145+
display: inline-flex;
146+
padding: 0;
147+
text-overflow: ellipsis;
148+
color: var(--color-text-white);
149+
position: relative;
150+
top: 9px;
151+
min-width: 85px;
152+
max-height: 36px;
153+
154+
&.error {
155+
background-color: var(--color-error);
156+
color: var(--color-main-background);
157+
border-radius: 3px;
158+
}
159+
}
160+
</style>
161+
162+
<style lang="scss">
163+
.saved-status,.saving-status {
146164
display: inline-flex;
147165
justify-content: center;
148166
padding: 0;

src/components/Menu/ActionEntry.scss

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
$text-menubar-action-white-color: white;
2-
31
%text__is-active-item-btn {
42
opacity: 1;
53
background-color: var(--color-primary-light);
@@ -10,13 +8,14 @@ $text-menubar-action-white-color: white;
108
}
119

1210
.text-menubar, .v-popper__inner {
11+
--text-menubar-action-white-color: white;
1312
button.entry-action__button {
1413
height: 44px;
1514
margin: 0;
1615
border: 0;
1716
// opacity: 0.5;
1817
position: relative;
19-
color: $text-menubar-action-white-color;
18+
color: var(--text-menubar-action-white-color);
2019
background-color: transparent;
2120
vertical-align: top;
2221
box-shadow: none;
@@ -69,7 +68,7 @@ $text-menubar-action-white-color: white;
6968

7069
.button-vue {
7170
svg {
72-
fill: $text-menubar-action-white-color;
71+
fill: var(--text-menubar-action-white-color);
7372
}
7473
&:hover,
7574
&:focus,

src/components/Menu/MenuBar.vue

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
<HelpModal v-if="displayHelp" @close="hideHelp" />
3737
<div class="text-menubar--logo">
3838
<a href="/">
39-
<img src="http://nextcloud.local/core/img/logo/logo.svg">
39+
<img src="../../../../../core/img/logo/logo.svg">
4040
</a>
4141
<p>{{ fileName }}</p>
4242
</div>
@@ -245,13 +245,16 @@ export default {
245245
</script>
246246

247247
<style lang="scss">
248-
$color-white: white;
249248
.text-menubar {
249+
--color-white: white;
250250
--background-blur: blur(10px);
251251
position: fixed;
252252
top: 0;
253-
z-index: 10021; // above modal-header so menubar is always on top
254-
background-color: var(--color-main-background-translucent);
253+
width: 100%;
254+
display: flex;
255+
justify-content: flex-end;
256+
background-color: var(--color-primary);
257+
z-index: 10021; // above modal-header and menububble so menubar is always on top
255258
backdrop-filter: var(--background-blur);
256259
max-height: 44px; // important for mobile so that the buttons are always inside the container
257260
padding-top:3px;
@@ -292,15 +295,15 @@ export default {
292295
flex-grow: 1;
293296
margin-left: calc((100% - var(--text-editor-max-width) - 25%) / 2);
294297
button, .icon, .entry-action {
295-
color: $color-white !important;
298+
color: var(--color-white) !important;
296299
}
297300
}
298301
299302
.text-menubar__slot {
300303
justify-content: flex-end;
301304
display: flex;
302305
.action-item svg {
303-
fill: $color-white;
306+
fill: var(--color-white);
304307
}
305308
}
306309

src/helpers/files.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,13 @@ const optimalPath = function(from, to) {
5050
: to
5151
}
5252

53-
const getRootPath = function() {
54-
if (getCurrentUser()) {
55-
return generateRemoteUrl(`dav/files/${getCurrentUser().uid}`)
56-
} else {
57-
return generateRemoteUrl('webdav').replace('/remote.php', '/public.php')
53+
const getRootPath = () => {
54+
const user = getCurrentUser()
55+
if (user) {
56+
return generateRemoteUrl(`dav/files/${user.uid}`)
5857
}
58+
59+
return generateRemoteUrl('webdav').replace('/remote.php', '/public.php')
5960
}
6061

6162
const registerFileCreate = () => {

0 commit comments

Comments
 (0)