From 724e812972cdaf55b0c2e8d3ebbb31637c405f57 Mon Sep 17 00:00:00 2001 From: syuilo Date: Fri, 8 Jun 2018 20:57:02 +0900 Subject: [PATCH] Refactor --- .../app/common/views/components/index.ts | 2 + .../common/views/components/note-header.vue | 112 ++++++++++++++++++ .../desktop/views/components/note-preview.vue | 54 +-------- .../views/components/notes.note.sub.vue | 71 +---------- .../desktop/views/components/notes.note.vue | 79 +----------- .../views/pages/deck/deck.note.sub.vue | 80 +------------ .../desktop/views/pages/deck/deck.note.vue | 76 +----------- .../mobile/views/components/note-preview.vue | 79 +----------- .../app/mobile/views/components/note.sub.vue | 81 +------------ .../app/mobile/views/components/note.vue | 78 +----------- 10 files changed, 128 insertions(+), 584 deletions(-) create mode 100644 src/client/app/common/views/components/note-header.vue diff --git a/src/client/app/common/views/components/index.ts b/src/client/app/common/views/components/index.ts index f30e3f953..803854468 100644 --- a/src/client/app/common/views/components/index.ts +++ b/src/client/app/common/views/components/index.ts @@ -2,6 +2,7 @@ import Vue from 'vue'; import analogClock from './analog-clock.vue'; import menu from './menu.vue'; +import noteHeader from './note-header.vue'; import signin from './signin.vue'; import signup from './signup.vue'; import forkit from './forkit.vue'; @@ -31,6 +32,7 @@ import welcomeTimeline from './welcome-timeline.vue'; Vue.component('mk-analog-clock', analogClock); Vue.component('mk-menu', menu); +Vue.component('mk-note-header', noteHeader); Vue.component('mk-signin', signin); Vue.component('mk-signup', signup); Vue.component('mk-forkit', forkit); diff --git a/src/client/app/common/views/components/note-header.vue b/src/client/app/common/views/components/note-header.vue new file mode 100644 index 000000000..611a14f73 --- /dev/null +++ b/src/client/app/common/views/components/note-header.vue @@ -0,0 +1,112 @@ + + + + + diff --git a/src/client/app/desktop/views/components/note-preview.vue b/src/client/app/desktop/views/components/note-preview.vue index 1d9ee2cd0..fed3b37f4 100644 --- a/src/client/app/desktop/views/components/note-preview.vue +++ b/src/client/app/desktop/views/components/note-preview.vue @@ -2,22 +2,7 @@
-
- {{ note.user | userName }} - -
- %fa:mobile-alt% - - - - - - - - - -
-
+
@@ -56,43 +41,6 @@ root(isDark) flex 1 min-width 0 - > header - display flex - align-items baseline - white-space nowrap - - > .name - margin 0 .5em 0 0 - padding 0 - overflow hidden - color isDark ? #fff : #607073 - font-size 1em - font-weight bold - text-decoration none - text-overflow ellipsis - - &:hover - text-decoration underline - - > .username - margin 0 .5em 0 0 - overflow hidden - text-overflow ellipsis - color isDark ? #606984 : #d1d8da - - > .info - margin-left auto - font-size 0.9em - - > * - color isDark ? #606984 : #b2b8bb - - > .mobile - margin-right 6px - - > .visibility - margin-left 6px - > .body > .text diff --git a/src/client/app/desktop/views/components/notes.note.sub.vue b/src/client/app/desktop/views/components/notes.note.sub.vue index 827112ecd..a8186fb7e 100644 --- a/src/client/app/desktop/views/components/notes.note.sub.vue +++ b/src/client/app/desktop/views/components/notes.note.sub.vue @@ -2,25 +2,7 @@
-
- {{ note.user | userName }} - admin - bot - cat - -
- %fa:mobile-alt% - - - - - - - - - -
-
+
@@ -62,57 +44,8 @@ root(isDark) flex 1 min-width 0 - > header - display flex - align-items baseline + > .header margin-bottom 2px - white-space nowrap - - > .name - display block - margin 0 .5em 0 0 - padding 0 - overflow hidden - color isDark ? #fff : #607073 - font-size 1em - font-weight bold - text-decoration none - text-overflow ellipsis - - &:hover - text-decoration underline - - > .is-admin - > .is-bot - > .is-cat - align-self center - margin 0 0.5em 0 0 - padding 1px 5px - font-size 10px - color isDark ? #758188 : #aaa - border solid 1px isDark ? #57616f : #ddd - border-radius 3px - - &.is-admin - border-color isDark ? #d42c41 : #f56a7b - color isDark ? #d42c41 : #f56a7b - - > .username - margin 0 .5em 0 0 - color isDark ? #606984 : #d1d8da - - > .info - margin-left auto - font-size 0.9em - - > * - color isDark ? #606984 : #b2b8bb - - > .mobile - margin-right 6px - - > .visibility - margin-left 6px > .body diff --git a/src/client/app/desktop/views/components/notes.note.vue b/src/client/app/desktop/views/components/notes.note.vue index ca67373c2..2f185e335 100644 --- a/src/client/app/desktop/views/components/notes.note.vue +++ b/src/client/app/desktop/views/components/notes.note.vue @@ -14,26 +14,7 @@
-
- {{ p.user | userName }} - admin - bot - cat - -
- via {{ p.app.name }} - %fa:mobile-alt% - - - - - - - - - -
-
+

{{ p.cw }} @@ -409,64 +390,8 @@ root(isDark) flex 1 min-width 0 - > header - display flex - align-items baseline + > .header margin-bottom 4px - white-space nowrap - - > .name - display block - margin 0 .5em 0 0 - padding 0 - overflow hidden - color isDark ? #fff : #627079 - font-size 1em - font-weight bold - text-decoration none - text-overflow ellipsis - - &:hover - text-decoration underline - - > .is-admin - > .is-bot - > .is-cat - align-self center - margin 0 .5em 0 0 - padding 1px 6px - font-size 12px - color isDark ? #758188 : #aaa - border solid 1px isDark ? #57616f : #ddd - border-radius 3px - - &.is-admin - border-color isDark ? #d42c41 : #f56a7b - color isDark ? #d42c41 : #f56a7b - - > .username - margin 0 .5em 0 0 - overflow hidden - text-overflow ellipsis - color isDark ? #606984 : #ccc - - > .info - margin-left auto - font-size 0.9em - - > * - color isDark ? #606984 : #c0c0c0 - - > .mobile - margin-right 8px - - > .app - margin-right 8px - padding-right 8px - border-right solid 1px isDark ? #1c2023 : #eaeaea - - > .visibility - margin-left 8px > .body diff --git a/src/client/app/desktop/views/pages/deck/deck.note.sub.vue b/src/client/app/desktop/views/pages/deck/deck.note.sub.vue index b458b7418..6fc70b6af 100644 --- a/src/client/app/desktop/views/pages/deck/deck.note.sub.vue +++ b/src/client/app/desktop/views/pages/deck/deck.note.sub.vue @@ -2,25 +2,7 @@

-
- {{ note.user | userName }} - %i18n:@admin% - %i18n:@bot% - %i18n:@cat% - -
- %fa:mobile-alt% - - - - - - - - - -
-
+
@@ -72,66 +54,8 @@ root(isDark) flex 1 min-width 0 - > header - display flex - align-items baseline + > .header margin-bottom 2px - white-space nowrap - - > .avatar - flex-shrink 0 - margin-right 8px - width 18px - height 18px - border-radius 100% - - > .name - display block - margin 0 0.5em 0 0 - padding 0 - overflow hidden - color isDark ? #fff : #607073 - font-size 1em - font-weight 700 - text-align left - text-decoration none - text-overflow ellipsis - - &:hover - text-decoration underline - - > .is-admin - > .is-bot - > .is-cat - align-self center - margin 0 0.5em 0 0 - padding 1px 5px - font-size 0.8em - color isDark ? #758188 : #aaa - border solid 1px isDark ? #57616f : #ddd - border-radius 3px - - &.is-admin - border-color isDark ? #d42c41 : #f56a7b - color isDark ? #d42c41 : #f56a7b - - > .username - text-align left - margin 0 - color isDark ? #606984 : #d1d8da - - > .info - margin-left auto - font-size 0.9em - - > * - color isDark ? #606984 : #b2b8bb - - > .mobile - margin-right 6px - - > .visibility - margin-left 6px > .body diff --git a/src/client/app/desktop/views/pages/deck/deck.note.vue b/src/client/app/desktop/views/pages/deck/deck.note.vue index 27d1cb8d4..2dab8289e 100644 --- a/src/client/app/desktop/views/pages/deck/deck.note.vue +++ b/src/client/app/desktop/views/pages/deck/deck.note.vue @@ -14,25 +14,7 @@
-
- {{ p.user | userName }} - admin - bot - cat - -
- %fa:mobile-alt% - - - - - - - - - -
-
+

{{ p.cw }} @@ -292,62 +274,6 @@ root(isDark) flex 1 min-width 0 - > header - display flex - align-items baseline - white-space nowrap - - > .avatar - flex-shrink 0 - margin-right 8px - width 20px - height 20px - border-radius 100% - - > .name - display block - margin 0 0.5em 0 0 - padding 0 - overflow hidden - color isDark ? #fff : #627079 - font-weight bold - text-decoration none - text-overflow ellipsis - - > .is-admin - > .is-bot - > .is-cat - align-self center - margin 0 0.5em 0 0 - padding 1px 6px - font-size 0.8em - color isDark ? #758188 : #aaa - border solid 1px isDark ? #57616f : #ddd - border-radius 3px - - &.is-admin - border-color isDark ? #d42c41 : #f56a7b - color isDark ? #d42c41 : #f56a7b - - > .username - margin 0 0.5em 0 0 - overflow hidden - text-overflow ellipsis - color isDark ? #606984 : #ccc - - > .info - margin-left auto - font-size 0.9em - - > * - color isDark ? #606984 : #c0c0c0 - - > .mobile - margin-right 6px - - > .visibility - margin-left 6px - > .body > .cw diff --git a/src/client/app/mobile/views/components/note-preview.vue b/src/client/app/mobile/views/components/note-preview.vue index 77ca99e97..388ac5c09 100644 --- a/src/client/app/mobile/views/components/note-preview.vue +++ b/src/client/app/mobile/views/components/note-preview.vue @@ -2,26 +2,7 @@

-
- - {{ note.user | userName }} - %i18n:@admin% - %i18n:@bot% - %i18n:@cat% - -
- %fa:mobile-alt% - - - - - - - - - -
-
+
@@ -79,64 +60,8 @@ root(isDark) flex 1 min-width 0 - > header - display flex - align-items baseline + > .header margin-bottom 2px - white-space nowrap - - > .avatar - flex-shrink 0 - margin-right 8px - width 18px - height 18px - border-radius 100% - - > .name - display block - margin 0 .5em 0 0 - padding 0 - overflow hidden - color isDark ? #fff : #607073 - font-size 1em - font-weight 700 - text-align left - text-decoration none - text-overflow ellipsis - - > .is-admin - > .is-bot - > .is-cat - align-self center - margin 0 0.5em 0 0 - padding 1px 6px - font-size 0.8em - color isDark ? #758188 : #aaa - border solid 1px isDark ? #57616f : #ddd - border-radius 3px - - &.is-admin - border-color isDark ? #d42c41 : #f56a7b - color isDark ? #d42c41 : #f56a7b - - > .username - margin 0 .5em 0 0 - overflow hidden - text-overflow ellipsis - color isDark ? #606984 : #d1d8da - - > .info - margin-left auto - font-size 0.9em - - > * - color isDark ? #606984 : #b2b8bb - - > .mobile - margin-right 6px - - > .visibility - margin-left 6px > .body diff --git a/src/client/app/mobile/views/components/note.sub.vue b/src/client/app/mobile/views/components/note.sub.vue index f487b7647..f757b2e52 100644 --- a/src/client/app/mobile/views/components/note.sub.vue +++ b/src/client/app/mobile/views/components/note.sub.vue @@ -2,26 +2,7 @@
-
- - {{ note.user | userName }} - %i18n:@admin% - %i18n:@bot% - %i18n:@cat% - -
- %fa:mobile-alt% - - - - - - - - - -
-
+
@@ -92,66 +73,8 @@ root(isDark) flex 1 min-width 0 - > header - display flex - align-items baseline + > .header margin-bottom 2px - white-space nowrap - - > .avatar - flex-shrink 0 - margin-right 8px - width 18px - height 18px - border-radius 100% - - > .name - display block - margin 0 0.5em 0 0 - padding 0 - overflow hidden - color isDark ? #fff : #607073 - font-size 1em - font-weight 700 - text-align left - text-decoration none - text-overflow ellipsis - - &:hover - text-decoration underline - - > .is-admin - > .is-bot - > .is-cat - align-self center - margin 0 0.5em 0 0 - padding 1px 5px - font-size 0.8em - color isDark ? #758188 : #aaa - border solid 1px isDark ? #57616f : #ddd - border-radius 3px - - &.is-admin - border-color isDark ? #d42c41 : #f56a7b - color isDark ? #d42c41 : #f56a7b - - > .username - text-align left - margin 0 - color isDark ? #606984 : #d1d8da - - > .info - margin-left auto - font-size 0.9em - - > * - color isDark ? #606984 : #b2b8bb - - > .mobile - margin-right 6px - - > .visibility - margin-left 6px > .body diff --git a/src/client/app/mobile/views/components/note.vue b/src/client/app/mobile/views/components/note.vue index 37d86fe23..127f62868 100644 --- a/src/client/app/mobile/views/components/note.vue +++ b/src/client/app/mobile/views/components/note.vue @@ -14,26 +14,7 @@
-
- - {{ p.user | userName }} - admin - bot - cat - -
- %fa:mobile-alt% - - - - - - - - - -
-
+

{{ p.cw }} @@ -358,65 +339,10 @@ root(isDark) flex 1 min-width 0 - > header - display flex - align-items baseline - white-space nowrap - + > .header @media (min-width 500px) margin-bottom 2px - > .avatar - flex-shrink 0 - margin-right 8px - width 20px - height 20px - border-radius 100% - - > .name - display block - margin 0 0.5em 0 0 - padding 0 - overflow hidden - color isDark ? #fff : #627079 - font-weight bold - text-decoration none - text-overflow ellipsis - - > .is-admin - > .is-bot - > .is-cat - align-self center - margin 0 0.5em 0 0 - padding 1px 6px - font-size 0.8em - color isDark ? #758188 : #aaa - border solid 1px isDark ? #57616f : #ddd - border-radius 3px - - &.is-admin - border-color isDark ? #d42c41 : #f56a7b - color isDark ? #d42c41 : #f56a7b - - > .username - margin 0 0.5em 0 0 - overflow hidden - text-overflow ellipsis - color isDark ? #606984 : #ccc - - > .info - margin-left auto - font-size 0.9em - - > * - color isDark ? #606984 : #c0c0c0 - - > .mobile - margin-right 6px - - > .visibility - margin-left 6px - > .body @media (min-width 700px) font-size 1.1em