Skip to content

Commit 24e1a74

Browse files
authored
feat(ui): UI/UX improvements for the Editor (#154)
* feat: temporary change the default logo of the Maglev UI * feat: use a trash bin icon as the delete action icon * feat(ui): better looking modal/slider close buttons * feat(ui): revamp the header nav * feat: display the locale in the path displayed in the page-info component * feat: hide the SectionHighlighter component when scrolling the preview iframe * chore: small fixes preventing the installation of Maglev in a blank Rails app * fix(ui): deal with long page titles and paths * feat(ui): use better icons for the list of pages + clone page action
1 parent b18709a commit 24e1a74

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+610
-486
lines changed

.annotaterb.yml

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
---
2+
:position: before
3+
:position_in_additional_file_patterns: before
4+
:position_in_class: before
5+
:position_in_factory: before
6+
:position_in_fixture: before
7+
:position_in_routes: before
8+
:position_in_serializer: before
9+
:position_in_test: before
10+
:classified_sort: true
11+
:exclude_controllers: true
12+
:exclude_factories: false
13+
:exclude_fixtures: false
14+
:exclude_helpers: true
15+
:exclude_scaffolds: true
16+
:exclude_serializers: false
17+
:exclude_sti_subclasses: false
18+
:exclude_tests: false
19+
:force: false
20+
:format_markdown: false
21+
:format_rdoc: false
22+
:format_yard: false
23+
:frozen: false
24+
:ignore_model_sub_dir: false
25+
:ignore_unknown_models: false
26+
:include_version: false
27+
:show_check_constraints: false
28+
:show_complete_foreign_keys: false
29+
:show_foreign_keys: true
30+
:show_indexes: true
31+
:simple_indexes: false
32+
:sort: false
33+
:timestamp: false
34+
:trace: false
35+
:with_comment: true
36+
:with_column_comments: true
37+
:with_table_comments: true
38+
:active_admin: false
39+
:command:
40+
:debug: false
41+
:hide_default_column_types: ''
42+
:hide_limit_column_types: ''
43+
:ignore_columns:
44+
:ignore_routes:
45+
:models: true
46+
:routes: false
47+
:skip_on_db_migrate: false
48+
:target_action: :do_annotations
49+
:wrapper:
50+
:wrapper_close:
51+
:wrapper_open:
52+
:classes_default_to_s: []
53+
:additional_file_patterns: []
54+
:model_dir:
55+
- app/models
56+
:require: []
57+
:root_dir:
58+
- ''

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,7 @@ node_modules
3838
bin/test
3939

4040
spec/dummy/db/*.sqlite3
41-
spec/legacy_dummy/db/*.sqlite3
41+
spec/legacy_dummy/db/*.sqlite3
42+
43+
docs/
44+
TODO.md

Gemfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ group :development, :test do
5252

5353
gem 'nokogiri', '>= 1.15.6'
5454

55-
gem 'annotate'
55+
gem 'annotaterb'
5656

5757
gem 'rdoc', '>= 6.6.3.1'
5858
end

Gemfile.lock

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -83,22 +83,20 @@ GEM
8383
securerandom (>= 0.3)
8484
tzinfo (~> 2.0, >= 2.0.5)
8585
uri (>= 0.13.1)
86-
annotate (2.6.5)
87-
activerecord (>= 2.3.0)
88-
rake (>= 0.8.7)
86+
annotaterb (4.14.0)
8987
ast (2.4.2)
9088
base64 (0.2.0)
9189
bcrypt (3.1.20)
9290
benchmark (0.4.0)
93-
bigdecimal (3.1.8)
91+
bigdecimal (3.1.9)
9492
builder (3.3.0)
95-
concurrent-ruby (1.3.4)
96-
connection_pool (2.4.1)
93+
concurrent-ruby (1.3.5)
94+
connection_pool (2.5.3)
9795
crass (1.0.6)
9896
date (3.4.1)
9997
diff-lcs (1.5.1)
10098
docile (1.4.1)
101-
drb (2.2.1)
99+
drb (2.2.3)
102100
dry-cli (1.2.0)
103101
erubi (1.13.0)
104102
factory_bot (6.2.1)
@@ -121,7 +119,7 @@ GEM
121119
railties (>= 3.0.0)
122120
globalid (1.2.1)
123121
activesupport (>= 6.1)
124-
i18n (1.14.6)
122+
i18n (1.14.7)
125123
concurrent-ruby (~> 1.0)
126124
image_processing (1.12.2)
127125
mini_magick (>= 4.9.5, < 5)
@@ -147,7 +145,7 @@ GEM
147145
kaminari-core (= 1.2.2)
148146
kaminari-core (1.2.2)
149147
language_server-protocol (3.17.0.3)
150-
logger (1.6.1)
148+
logger (1.7.0)
151149
loofah (2.23.1)
152150
crass (~> 1.0.2)
153151
nokogiri (>= 1.12.0)
@@ -160,7 +158,7 @@ GEM
160158
marcel (1.0.4)
161159
mini_magick (4.13.2)
162160
mini_mime (1.1.5)
163-
minitest (5.25.2)
161+
minitest (5.25.5)
164162
mutex_m (0.3.0)
165163
net-imap (0.5.8)
166164
date
@@ -304,7 +302,7 @@ GEM
304302
ruby-vips (2.2.2)
305303
ffi (~> 1.12)
306304
logger
307-
securerandom (0.3.2)
305+
securerandom (0.4.1)
308306
simplecov (0.22.0)
309307
docile (~> 1.1)
310308
simplecov-html (~> 0.11)
@@ -323,11 +321,11 @@ GEM
323321
sqlite3 (2.6.0-x86_64-linux-musl)
324322
stringio (3.1.2)
325323
thor (1.3.2)
326-
timeout (0.4.2)
324+
timeout (0.4.3)
327325
tzinfo (2.0.6)
328326
concurrent-ruby (~> 1.0)
329327
unicode-display_width (2.6.0)
330-
uri (1.0.2)
328+
uri (1.0.3)
331329
useragent (0.16.10)
332330
vite_rails (3.0.19)
333331
railties (>= 5.1, < 9)
@@ -361,7 +359,7 @@ PLATFORMS
361359
x86_64-linux-musl
362360

363361
DEPENDENCIES
364-
annotate
362+
annotaterb
365363
bcrypt
366364
factory_bot_rails (~> 6.2.0)
367365
generator_spec

Gemfile.rails_7_2

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,6 @@ group :development, :test do
5959

6060
gem 'nokogiri', '>= 1.15.6'
6161

62-
gem 'annotate'
63-
6462
gem 'rdoc', '>= 6.6.3.1'
6563
end
6664

Gemfile.rails_7_2.lock

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,6 @@ GEM
8383
minitest (>= 5.1)
8484
securerandom (>= 0.3)
8585
tzinfo (~> 2.0, >= 2.0.5)
86-
annotate (3.2.0)
87-
activerecord (>= 3.2, < 8.0)
88-
rake (>= 10.4, < 14.0)
8986
ast (2.4.2)
9087
base64 (0.2.0)
9188
bcrypt (3.1.20)
@@ -362,7 +359,6 @@ PLATFORMS
362359
x86_64-linux-musl
363360

364361
DEPENDENCIES
365-
annotate
366362
bcrypt
367363
factory_bot_rails (~> 6.2.0)
368364
generator_spec

Rakefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,9 @@ require 'vite_ruby'
2020
ViteRuby.install_tasks
2121
ViteRuby.config.root # Ensure the engine is set as the root.
2222

23-
rakefile_path = Rails::VERSION::MAJOR >= 8 ? 'spec/dummy/Rakefile' : 'spec/legacy_dummy/Rakefile'
23+
rakefile_path = !defined?(Rails) || Rails::VERSION::MAJOR >= 8 ? 'spec/dummy/Rakefile' : 'spec/legacy_dummy/Rakefile'
2424
APP_RAKEFILE = File.expand_path(rakefile_path, __dir__)
25+
2526
load 'rails/tasks/engine.rake'
2627
load 'rails/tasks/statistics.rake'
2728

Lines changed: 1 addition & 0 deletions
Loading
Lines changed: 1 addition & 0 deletions
Loading
Lines changed: 1 addition & 0 deletions
Loading

app/frontend/editor/components/header-nav/device-toggler.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
:color="icon.color"
88
class="cursor-pointer hover:bg-editor-primary hover:bg-opacity-5 px-2"
99
:class="{
10-
'mx-2': index === 1,
10+
'mx-1': index === 1,
1111
'bg-editor-primary bg-opacity-5': device === icon.device
1212
}"
1313
size="2.5rem"

app/frontend/editor/components/header-nav/index.vue

Lines changed: 13 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -7,54 +7,26 @@
77
<div class="h-6 bg-gray-200 rounded w-1/4 mx-6"></div>
88
<div class="h-6 bg-gray-200 rounded w-1/4 mx-6"></div>
99
</div>
10-
<div class="flex justify-between h-full w-full" v-else>
11-
<div class="flex">
12-
<router-link
13-
:to="{ name: 'listPages' }"
14-
class="flex items-center py-4 px-6 flex-row hover:bg-editor-primary hover:bg-opacity-5 transition-colors duration-200"
15-
:class="{
16-
'bg-white': !isListPagesActive,
17-
'bg-editor-primary bg-opacity-5': isListPagesActive,
18-
}"
19-
>
20-
<span>{{ $t('headerNav.pages') }}</span>
21-
<uikit-page-icon class="ml-4" :page="currentPage" />
22-
<span class="ml-2">{{ currentPage.title }}</span>
23-
<uikit-icon name="arrow-down-s-line" class="ml-3" />
24-
</router-link>
25-
26-
<separator />
27-
28-
<router-link
29-
:to="{ name: 'editPageSettings' }"
30-
class="flex items-center py-4 px-6 flex-row hover:bg-editor-primary hover:bg-opacity-5 transition-colors duration-200"
31-
:class="{
32-
'bg-white': !isEditPageActive,
33-
'bg-editor-primary bg-opacity-5': isEditPageActive,
34-
}"
35-
>
36-
<uikit-icon name="settings-4-line" size="1.25rem" />
37-
<span class="ml-2">{{ $t('headerNav.pageSettings') }}</span>
38-
</router-link>
39-
40-
<separator />
10+
<div class="grid grid-cols-5 h-full w-full" v-else>
11+
<div class="col-span-3 lg:col-span-2">
12+
<page-info />
4113
</div>
4214

43-
<div class="flex">
44-
<div class="flex items-center px-6">
45-
<device-toggler />
46-
</div>
47-
<separator />
15+
<div class="col-span-1 hidden lg:flex justify-center">
16+
<device-toggler />
17+
</div>
4818

19+
<div class="col-span-2 flex justify-end h-full">
4920
<div class="flex h-full relative" v-if="hasMultipleLocales">
5021
<locale-toggler />
5122
</div>
5223
<separator v-if="hasMultipleLocales" />
5324

5425
<preview-toggler v-if="isSitePublishable" />
55-
<preview-button v-else />
26+
<preview-button v-else class="hidden lg:flex" />
5627

5728
<separator v-if="isSitePublishable" />
29+
5830
<div
5931
class="flex items-center h-full relative space-x-1 pr-4"
6032
v-if="isSitePublishable"
@@ -64,7 +36,7 @@
6436
</div>
6537

6638
<div v-else>
67-
<save-button :big="true" />
39+
<save-button big />
6840
</div>
6941
</div>
7042
</div>
@@ -79,6 +51,7 @@ import PreviewToggler from './preview-toggler.vue'
7951
import PublishButton from './publish-button.vue'
8052
import SaveButton from './save-button.vue'
8153
import Separator from './separator.vue'
54+
import PageInfo from './page-info.vue'
8255
8356
export default {
8457
name: 'HeaderNav',
@@ -90,17 +63,15 @@ export default {
9063
SaveButton,
9164
Separator,
9265
PreviewToggler,
66+
PageInfo,
9367
},
9468
computed: {
9569
isLoading() {
9670
return !this.currentSite || !this.currentPage
9771
},
9872
isListPagesActive() {
9973
return this.$route.name === 'listPages'
100-
},
101-
isEditPageActive() {
102-
return this.$route.name === 'editPageSettings'
103-
},
74+
},
10475
},
10576
}
10677
</script>
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<template>
2+
<div class="flex items-center h-full px-4 flex-row w-full overflow-hidden">
3+
<uikit-page-icon :page="currentPage" size="1.75rem" class="shrink-0" />
4+
<div class="ml-4 flex flex-col leading-none overflow-hidden">
5+
<div class="text-base font-semibold truncate">{{ currentPage.title }}</div>
6+
<div class="text-xs text-gray-500 -mt-0.5 flex items-center space-x-1">
7+
<span class="truncate">{{ currentPagePath }}</span>
8+
<uikit-copy-paste-button :text-to-copy="currentPageUrl" />
9+
</div>
10+
</div>
11+
</div>
12+
</template>
13+
14+
<script>
15+
import { mapGetters } from 'vuex'
16+
17+
export default {
18+
name: 'PageInfo',
19+
computed: {
20+
...mapGetters(['currentPagePath', 'currentPageUrl']),
21+
}
22+
}
23+
</script>

app/frontend/editor/components/header-nav/preview-button.vue

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<template>
22
<a
3-
:href="currentPage.previewUrl"
3+
:href="currentPageUrl"
44
target="_blank"
55
class="px-6 flex items-center hover:bg-editor-primary/5 transition-colors duration-200"
66
>
@@ -11,5 +11,10 @@
1111
<script>
1212
export default {
1313
name: 'PreviewButton',
14+
computed: {
15+
currentPageUrl() {
16+
return this.currentPage.liveUrl
17+
},
18+
},
1419
}
1520
</script>

app/frontend/editor/components/header-nav/separator.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<template>
2-
<div class="h-full py-4 w-px">
2+
<div class="h-full py-4 w-px shrink-0">
33
<div class="h-full w-full bg-gray-300" />
44
</div>
55
</template>

0 commit comments

Comments
 (0)