From 3342fbb91850d245f5694b60249561d9014954e5 Mon Sep 17 00:00:00 2001 From: Jeremy Wharton Date: Tue, 30 Aug 2022 16:25:14 -0500 Subject: [PATCH] web/satellite: make project dashboard/overview responsive This change modifies the new project dashboard to accommodate small screen sizes. Resolves https://github.com/storj/storj/issues/5036 Change-Id: I27a8acd144a24f21f0fa43808640ba5bca6b49a8 --- .../components/common/VDateRangePicker.vue | 18 ++- .../components/project/buckets/BucketArea.vue | 26 +++- .../components/project/buckets/BucketItem.vue | 118 +++++++++++++++--- .../project/buckets/NoBucketsArea.vue | 3 +- .../NewProjectDashboard.vue | 114 ++++++++++++++--- .../static/images/project/bucket.svg | 3 + .../__snapshots__/BucketArea.spec.ts.snap | 4 +- .../__snapshots__/BucketItem.spec.ts.snap | 29 ++++- 8 files changed, 266 insertions(+), 49 deletions(-) create mode 100644 web/satellite/static/images/project/bucket.svg diff --git a/web/satellite/src/components/common/VDateRangePicker.vue b/web/satellite/src/components/common/VDateRangePicker.vue index 618e6e816..0a2a4b228 100644 --- a/web/satellite/src/components/common/VDateRangePicker.vue +++ b/web/satellite/src/components/common/VDateRangePicker.vue @@ -46,7 +46,7 @@ export default class VDateRangePicker extends Vue { } .mx-calendar { - width: 50%; + width: 100%; } .mx-date-row { @@ -107,4 +107,20 @@ export default class VDateRangePicker extends Vue { height: 20px; border-width: 4px 0 0 4px; } + + @media screen and (max-width: 768px) { + + .range-selection__popup { + width: 320px !important; + } + + .mx-range-wrapper { + flex-direction: column; + } + + .mx-calendar + .mx-calendar { + border-left: none; + border-top: 1px solid #e8e8e8; + } + } diff --git a/web/satellite/src/components/project/buckets/BucketArea.vue b/web/satellite/src/components/project/buckets/BucketArea.vue index 9256d141d..9e015f31e 100644 --- a/web/satellite/src/components/project/buckets/BucketArea.vue +++ b/web/satellite/src/components/project/buckets/BucketArea.vue @@ -14,7 +14,7 @@ />
- + :deep(*:not(:first-child)) { + border-top: 1px solid #c7cdd2; + } + } + } diff --git a/web/satellite/src/components/project/buckets/BucketItem.vue b/web/satellite/src/components/project/buckets/BucketItem.vue index 89bba250b..834eb5da9 100644 --- a/web/satellite/src/components/project/buckets/BucketItem.vue +++ b/web/satellite/src/components/project/buckets/BucketItem.vue @@ -3,11 +3,30 @@ @@ -16,8 +35,14 @@ import { Component, Prop, Vue } from 'vue-property-decorator'; import { Bucket } from '@/types/buckets'; +import BucketIcon from '@/../static/images/project/bucket.svg'; + // @vue/component -@Component +@Component({ + components: { + BucketIcon, + } +}) export default class BucketItem extends Vue { @Prop({default: () => new Bucket('', 0, 0, 0, 0, new Date(), new Date())}) private readonly itemData: Bucket; @@ -29,22 +54,81 @@ export default class BucketItem extends Vue { padding: 20px 40px; outline: none; display: flex; - background: #fff; margin-bottom: 1px; - width: calc(100% - 80px); + box-sizing: border-box; + font-family: 'font_medium', sans-serif; + font-size: 16px; + + &__header { + width: 100%; + display: flex; + align-items: center; + + &__icon { + display: none; + margin-right: 10px; + } + + &__name { + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; + } + } &__item { - width: 20%; - font-family: 'font_medium', sans-serif; - font-size: 16px; - margin: 0; + display: flex; + width: 100%; + + &__inner { + width: 50%; + + &__label { + display: none; + margin-bottom: 4px; + font-family: 'font_regular', sans-serif; + font-size: 14px; + } + } } } - .name { - width: 40%; - white-space: nowrap; - overflow: hidden; - text-overflow: ellipsis; + @media screen and (max-width: 960px) { + + .container { + flex-wrap: wrap; + padding: 20px 24px; + + &__header { + + &__icon { + display: block; + } + + &__name { + font-family: 'font_bold', sans-serif; + } + } + + &__item { + width: 50%; + margin-top: 16px; + + &__inner__label { + display: block; + } + } + } + } + + @media screen and (max-width: 600px) { + + .container { + flex-direction: column; + + &__item { + width: 100%; + } + } } diff --git a/web/satellite/src/components/project/buckets/NoBucketsArea.vue b/web/satellite/src/components/project/buckets/NoBucketsArea.vue index b272b76e0..c0cc9d6b3 100644 --- a/web/satellite/src/components/project/buckets/NoBucketsArea.vue +++ b/web/satellite/src/components/project/buckets/NoBucketsArea.vue @@ -76,7 +76,8 @@ export default class NoBucketArea extends Vue { font-size: 18px; line-height: 26px; color: #354049; - margin: 15px 0 30px; + margin: 15px 15px 30px; + text-align: center; } &__second-button { diff --git a/web/satellite/src/components/project/newProjectDashboard/NewProjectDashboard.vue b/web/satellite/src/components/project/newProjectDashboard/NewProjectDashboard.vue index 24e258d10..7164eb1ce 100644 --- a/web/satellite/src/components/project/newProjectDashboard/NewProjectDashboard.vue +++ b/web/satellite/src/components/project/newProjectDashboard/NewProjectDashboard.vue @@ -2,7 +2,7 @@ // See LICENSE for copying information. Buckets

- + @@ -232,7 +231,7 @@ export default class NewProjectDashboard extends Vue { public chartWidth = 0; public $refs: { - dashboard: HTMLDivElement; + chartContainer: HTMLDivElement; } public readonly analytics: AnalyticsHttpApi = new AnalyticsHttpApi(); @@ -290,9 +289,7 @@ export default class NewProjectDashboard extends Vue { * Used container size recalculation for charts resizing. */ public recalculateChartWidth(): void { - // sixty pixels. - const additionalPaddingRight = 60; - this.chartWidth = this.$refs.dashboard.getBoundingClientRect().width / 2 - additionalPaddingRight; + this.chartWidth = this.$refs.chartContainer.getBoundingClientRect().width; } /** @@ -435,7 +432,6 @@ export default class NewProjectDashboard extends Vue { diff --git a/web/satellite/static/images/project/bucket.svg b/web/satellite/static/images/project/bucket.svg new file mode 100644 index 000000000..ae85b8340 --- /dev/null +++ b/web/satellite/static/images/project/bucket.svg @@ -0,0 +1,3 @@ + + + diff --git a/web/satellite/tests/unit/project/buckets/__snapshots__/BucketArea.spec.ts.snap b/web/satellite/tests/unit/project/buckets/__snapshots__/BucketArea.spec.ts.snap index 00773c7a0..073e8afc3 100644 --- a/web/satellite/tests/unit/project/buckets/__snapshots__/BucketArea.spec.ts.snap +++ b/web/satellite/tests/unit/project/buckets/__snapshots__/BucketArea.spec.ts.snap @@ -8,7 +8,7 @@ exports[`BucketArea.vue renders correctly with bucket 1`] = `
- +
@@ -25,7 +25,7 @@ exports[`BucketArea.vue renders correctly with pagination 1`] = `
- +
diff --git a/web/satellite/tests/unit/project/buckets/__snapshots__/BucketItem.spec.ts.snap b/web/satellite/tests/unit/project/buckets/__snapshots__/BucketItem.spec.ts.snap index 0b3bb5b4d..5a349c3e5 100644 --- a/web/satellite/tests/unit/project/buckets/__snapshots__/BucketItem.spec.ts.snap +++ b/web/satellite/tests/unit/project/buckets/__snapshots__/BucketItem.spec.ts.snap @@ -2,10 +2,29 @@ exports[`BucketItem.vue renders correctly 1`] = `
-

name

-

1.00GB

-

1.00GB

-

1

-

1

+
+ +

name

+
+
+
+

Storage

+

1.00GB

+
+
+

Bandwidth

+

1.00GB

+
+
+
+
+

Objects

+

1

+
+
+

Segments

+

1

+
+
`;