From 18193778971e27d18b5a35df8c2d0e2953b48111 Mon Sep 17 00:00:00 2001 From: Ramires Viana <59319979+ramiresviana@users.noreply.github.com> Date: Tue, 16 Feb 2021 15:39:11 +0000 Subject: [PATCH 01/12] feat: improved sharing prompt --- frontend/public/themes/dark.css | 4 +- frontend/src/components/prompts/Share.vue | 172 +++++++++++++--------- frontend/src/css/_share.css | 7 +- frontend/src/css/dashboard.css | 12 ++ http/share.go | 12 -- 5 files changed, 116 insertions(+), 91 deletions(-) diff --git a/frontend/public/themes/dark.css b/frontend/public/themes/dark.css index 9a5be1f7..2a70351c 100644 --- a/frontend/public/themes/dark.css +++ b/frontend/public/themes/dark.css @@ -119,8 +119,8 @@ nav > div { .dashboard p label { color: var(--textPrimary); } -.card#share ul li input, -.card#share ul li select, +.card#share input, +.card#share select, .input { background: var(--surfaceSecondary); color: var(--textPrimary); diff --git a/frontend/src/components/prompts/Share.vue b/frontend/src/components/prompts/Share.vue index 043847d8..f4163975 100644 --- a/frontend/src/components/prompts/Share.vue +++ b/frontend/src/components/prompts/Share.vue @@ -4,61 +4,82 @@

{{ $t('buttons.share') }}

-
-
@@ -75,11 +96,10 @@ export default { return { time: '', unit: 'hours', - hasPermanent: false, links: [], clip: null, password: '', - passwordPermalink: '' + listing: true } }, computed: { @@ -104,11 +124,8 @@ export default { this.links = links this.sort() - for (let link of this.links) { - if (link.expire === 0) { - this.hasPermanent = true - break - } + if (this.links.length == 0) { + this.listing = false } } catch (e) { this.$showError(e) @@ -125,22 +142,25 @@ export default { }, methods: { submit: async function () { - if (!this.time) return + let isPermanent = !this.time || this.time == 0 try { - const res = await api.create(this.url, this.password, this.time, this.unit) + let res = null + + if (isPermanent) { + res = await api.create(this.url, this.password) + } else { + res = await api.create(this.url, this.password, this.time, this.unit) + } + this.links.push(res) this.sort() - } catch (e) { - this.$showError(e) - } - }, - getPermalink: async function () { - try { - const res = await api.create(this.url, this.passwordPermalink) - this.links.push(res) - this.sort() - this.hasPermanent = true + + this.time = '' + this.unit = 'hours' + this.password = '' + + this.listing = true } catch (e) { this.$showError(e) } @@ -149,8 +169,11 @@ export default { event.preventDefault() try { await api.remove(link.hash) - if (link.expire === 0) this.hasPermanent = false this.links = this.links.filter(item => item.hash !== link.hash) + + if (this.links.length == 0) { + this.listing = false + } } catch (e) { this.$showError(e) } @@ -167,6 +190,13 @@ export default { if (b.expire === 0) return 1 return new Date(a.expire) - new Date(b.expire) }) + }, + switchListing () { + if (this.links.length == 0 && !this.listing) { + this.$store.commit('closeHovers') + } + + this.listing = !this.listing } } } diff --git a/frontend/src/css/_share.css b/frontend/src/css/_share.css index c043a73c..a5f2d35f 100644 --- a/frontend/src/css/_share.css +++ b/frontend/src/css/_share.css @@ -70,9 +70,4 @@ padding: .5em; text-align: center; animation: .2s opac forwards; -} - -.share__promt__card { - max-width: max-content !important; - width: auto !important; -} +} \ No newline at end of file diff --git a/frontend/src/css/dashboard.css b/frontend/src/css/dashboard.css index b29e907f..52a8d41e 100644 --- a/frontend/src/css/dashboard.css +++ b/frontend/src/css/dashboard.css @@ -226,6 +226,18 @@ table tr>*:last-child { opacity: 1; } +.card#share .input-group { + display: flex; +} + +.card#share .input-group * { + border: none; +} + +.card#share .input-group input { + flex: 1; +} + .overlay { background-color: rgba(0, 0, 0, 0.5); position: fixed; diff --git a/http/share.go b/http/share.go index 9ee28587..d813500e 100644 --- a/http/share.go +++ b/http/share.go @@ -6,7 +6,6 @@ import ( "encoding/json" "fmt" "net/http" - "path" "sort" "strconv" "strings" @@ -91,17 +90,6 @@ var sharePostHandler = withPermShare(func(w http.ResponseWriter, r *http.Request defer r.Body.Close() } - if body.Expires == "" { - var err error - s, err = d.store.Share.GetPermanent(r.URL.Path, d.user.ID) - if err == nil { - if _, err := w.Write([]byte(path.Join(d.server.BaseURL, "/share/", s.Hash))); err != nil { - return http.StatusInternalServerError, err - } - return 0, nil - } - } - bytes := make([]byte, 6) _, err := rand.Read(bytes) if err != nil { From db5aad8eb679cfe1b1ace5142cf342951217f0f7 Mon Sep 17 00:00:00 2001 From: Ramires Viana <59319979+ramiresviana@users.noreply.github.com> Date: Fri, 19 Feb 2021 13:15:46 +0000 Subject: [PATCH 02/12] feat: dual pane settings view --- frontend/src/css/dashboard.css | 26 +++- frontend/src/views/settings/Global.vue | 164 ++++++++++++------------ frontend/src/views/settings/Profile.vue | 58 +++++---- frontend/src/views/settings/Shares.vue | 72 ++++++----- frontend/src/views/settings/User.vue | 48 +++---- frontend/src/views/settings/Users.vue | 48 +++---- 6 files changed, 229 insertions(+), 187 deletions(-) diff --git a/frontend/src/css/dashboard.css b/frontend/src/css/dashboard.css index 52a8d41e..bece5d9d 100644 --- a/frontend/src/css/dashboard.css +++ b/frontend/src/css/dashboard.css @@ -1,8 +1,29 @@ .dashboard { - max-width: 600px; margin: 1em 0; } +.dashboard .row { + display: flex; + margin: 0 -.5em; + flex-wrap: wrap; +} + +.dashboard .row .column { + display: flex; + padding: 0 .5em; + width: 50%; +} + +.dashboard .row .column .card { + flex-grow: 1; +} + +@media(max-width: 1200px) { + .dashboard .row .column { + width: 100%; + } +} + a { color: inherit } @@ -92,7 +113,7 @@ table tr>*:last-child { .card { position: relative; - margin: .5rem 0 1rem 0; + margin: 0 0 1rem 0; background-color: #fff; border-radius: 2px; box-shadow: 0 2px 2px 0 rgba(0, 0, 0, 0.14), 0 1px 5px 0 rgba(0, 0, 0, 0.12), 0 3px 1px -2px rgba(0, 0, 0, 0.2); @@ -151,6 +172,7 @@ table tr>*:last-child { .card .card-content.full { padding-bottom: 0; + overflow: auto; } .card h2 { diff --git a/frontend/src/views/settings/Global.vue b/frontend/src/views/settings/Global.vue index 2f2f4b29..a4eadeb2 100644 --- a/frontend/src/views/settings/Global.vue +++ b/frontend/src/views/settings/Global.vue @@ -1,102 +1,108 @@ diff --git a/frontend/src/views/settings/Profile.vue b/frontend/src/views/settings/Profile.vue index 77c4fbe5..9a7503bd 100644 --- a/frontend/src/views/settings/Profile.vue +++ b/frontend/src/views/settings/Profile.vue @@ -1,36 +1,40 @@ diff --git a/frontend/src/views/settings/Shares.vue b/frontend/src/views/settings/Shares.vue index d8a2bb54..f1fd31d2 100644 --- a/frontend/src/views/settings/Shares.vue +++ b/frontend/src/views/settings/Shares.vue @@ -1,40 +1,44 @@ diff --git a/frontend/src/views/settings/User.vue b/frontend/src/views/settings/User.vue index 3cff063c..20c7e463 100644 --- a/frontend/src/views/settings/User.vue +++ b/frontend/src/views/settings/User.vue @@ -1,29 +1,31 @@