Skip to content

feat: 🍰 Webapp, Backend – User Profile – Display, Select and Upload User Profile Header Image #3634

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 17 commits into
base: master
Choose a base branch
from

Conversation

Tirokk
Copy link
Member

@Tirokk Tirokk commented Oct 5, 2020

DriesCruyskens Authored by DriesCruyskens
Jun 13, 2020


🍰 Pullrequest

Since this feature is pretty similar to uploading and displaying a user's profile avatar I was able to mostly mirror the already existing implementation. Here you can see the drag and drop in action as well as the standard grey header for when no previous image is available:

dragndrop

Clicking opens up a file browser to select a file to upload just as with a profile avatar.

The issue also mentions cropping the image (to not use unnecessary bandwidth I assume) although I am not sure what to expected behavior is when using the app on mobile. As u can see in the next GIF, the image is mostly visible on mobile screens and even exposes the grey background if the image is not tall enough. Should the container have a max-height depending on the height of the image so no grey background is visible on wide images? Or use a CSS background image with repeat instead of an <img> tag?

mobile resize

Extra notes

UserProfileHeader component

I did not not reuse the hc-upload component since that one already has avatar specific code and the styling needs to be different. I instead (sort off) merged the hc-upload and UserAvatar component into a new UserProfileHeader component.

back-end

I did not add new tests to image.spec.js since already contains test functions for a profile avatar and all functionality is shared. The only thing that had to be done is add the relationship type to the array of relationship types.

I also added a cleanDatabase() in passwordReset.spec.js and statistics.spec.js before all tests because they would fail. Presumably because of artifacts from previous tests?

Db seed

Unlike avatars, profile headers are not added to user accounts by default when seeding the database. I lot of tests failed because they do a hard-coded check of the total amount of images in the database. I tried changing the amounts but I can't quite figure out why the amounts are what they are as they seem very arbitrary so I thought it best to leave them as is. This way I can just mock profile headers when needed and not break any previous tests.

Locales

Purposefully didn't reuse the user.avatar.submitted but made a new user.profileHeader.submitted although the text is the same. There is no text for failed toasts because that just prints the error message.

Storybook

I did not add a storybook entry since the component is very basic and does not have different states. Let me know if you still think this is necessary.

Issues

Todo

  • Made header component and added it to the profile page + Graphql functionality.
  • Back-end functionality for the header image similar to avatar image.
  • Database seeds.
  • Unit tests web-app and back-end.
  • Integration tests.
  • Locales for the successful upload toast.
  • Cropping image?

DriesCruyskens and others added 17 commits June 12, 2020 18:18
…n gql schema, resolvers, models and database seed. Also added tests everywhere a user's profile avatar is also tested.
…a header image and added it to the profile page. Added locales in all languages for a succesful or failed upload toast. Included test for the new userProfileHeader component. Updated the gql model to include the profileHeader.
… header image. Adjusted existing tests for the profile image to make them more distinct.
… shrinks vertically when the profile picture is not tall enough to fill 250px. Changed css class to be more specific.
- Change `profile-header` to `profile-header-card`.
- Because of a sometimes failing test.
@Tirokk
Copy link
Member Author

Tirokk commented Oct 7, 2020

cypress[bot] Authored by cypress[bot]
Jun 13, 2020




Test summary

66 β€’ 2 β€’ 0 β€’ 0


Run details

Project Human-Connection
Status Failed
Commit d8f915d036 ℹ️
Started Jun 26, 2020 3:33 PM
Ended Jun 26, 2020 3:58 PM
Duration 24:57 πŸ’‘
OS Linux Ubuntu Linux - 16.04
Browser Firefox 68

View run in Cypress Dashboard ➑️


Failures

cypress/integration/user_profile/UploadUserProfileHeader.feature ⏯ 2 Failed
1 Upload UserProfile Header > Change my UserProfile Header
2 Upload UserProfile Header > Unable to change another user's header images

This comment has been generated by cypress-bot as a result of this project's GitHub integration settings. You can manage this integration in this project's settings in the Cypress Dashboard

@Tirokk
Copy link
Member Author

Tirokk commented Oct 7, 2020

cypress[bot] Authored by cypress[bot]
Jun 13, 2020




Test summary

66 β€’ 2 β€’ 0 β€’ 0


Run details

Project Human-Connection
Status Failed
Commit 3234012
Started Jun 26, 2020 3:33 PM
Ended Jun 26, 2020 3:57 PM
Duration 24:01 πŸ’‘
OS Linux Ubuntu Linux - 16.04
Browser Firefox 68

View run in Cypress Dashboard ➑️


Failures

cypress/integration/user_profile/UploadUserProfileHeader.feature ⏯ 2 Failed
1 Upload UserProfile Header > Change my UserProfile Header
2 Upload UserProfile Header > Unable to change another user's header images

This comment has been generated by cypress-bot as a result of this project's GitHub integration settings. You can manage this integration in this project's settings in the Cypress Dashboard

@Tirokk
Copy link
Member Author

Tirokk commented Oct 7, 2020

Tirokk Authored by Tirokk
Jun 17, 2020


Hey @DriesCruyskens ,

at my first glance you did again a wonderful job dear !!! πŸ€πŸš€πŸš€πŸš€πŸ’«β­οΈ

So far it works really good for me in my browsers. πŸ™πŸΌ
Because I have to quit work now I will have a closer look tomorrow I hope.

As far I would say let’s make additional issues out of …

  • cropping the header image (example done on the post creation page)
  • deleting the header image (dito)
  • and for later it would be nice the user gets able to delete the avatar as well (dito)

Otherwise this issue gets to big.

@@ -24,7 +24,8 @@ beforeEach(() => {
variables = {}
})

beforeAll(() => {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tirokk Authored by Tirokk
Jun 18, 2020


Outdated (history rewrite) - original diff


@@ -25,6 +25,7 @@ beforeEach(() => {
 })
 
 beforeAll(() => {
+  cleanDatabase()

Nice you added this! 😍

But the await is missing:

await cleanDatabase()

would be correct.

beforeAll(() => {
beforeAll(async () => {
// Clean the database so no artifacts from other test files are interfering.
await cleanDatabase()
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tirokk Authored by Tirokk
Jun 18, 2020


Outdated (history rewrite) - original diff


@@ -21,7 +21,9 @@ const statisticsQuery = gql`
     }
   }
 `
-beforeAll(() => {
+beforeAll(async () => {
+  // Clean the database so no artifacts from other test files are interfering.
+  await cleanDatabase()

πŸ˜πŸ‘πŸΌ

it('deletes user avatar and post hero images', async () => {
await expect(neode.all('Image')).resolves.toHaveLength(22)
it('deletes user avatar, profile header and post hero images', async () => {
await expect(neode.all('Image')).resolves.toHaveLength(23)
await mutate({ mutation: deleteUserMutation, variables })
await expect(neode.all('Image')).resolves.toHaveLength(20)
})
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tirokk Authored by Tirokk
Jun 18, 2020


Outdated (history rewrite) - original diff


@@ -496,8 +502,8 @@ describe('DeleteUser', () => {
                 ).resolves.toMatchObject(expectedResponse)
               })
 
-              it('deletes user avatar and post hero images', async () => {
-                await expect(neode.all('Image')).resolves.toHaveLength(22)
+              it('deletes user avatar, profile header and post hero images', async () => {
+                await expect(neode.all('Image')).resolves.toHaveLength(23)
                 await mutate({ mutation: deleteUserMutation, variables })
                 await expect(neode.all('Image')).resolves.toHaveLength(20)
               })

Thanks to add this test! πŸ’«
Cool 😎

it('deletes user avatar and post hero images', async () => {
await expect(neode.all('Image')).resolves.toHaveLength(22)
it('deletes user avatar, profile header and post hero images', async () => {
await expect(neode.all('Image')).resolves.toHaveLength(23)
await mutate({ mutation: deleteUserMutation, variables })
await expect(neode.all('Image')).resolves.toHaveLength(20)
})
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tirokk Authored by Tirokk
Jun 18, 2020


Outdated (history rewrite) - original diff


@@ -792,8 +804,8 @@ describe('DeleteUser', () => {
                 ).resolves.toMatchObject(expectedResponse)
               })
 
-              it('deletes user avatar and post hero images', async () => {
-                await expect(neode.all('Image')).resolves.toHaveLength(22)
+              it('deletes user avatar, profile header and post hero images', async () => {
+                await expect(neode.all('Image')).resolves.toHaveLength(23)
                 await mutate({ mutation: deleteUserMutation, variables })
                 await expect(neode.all('Image')).resolves.toHaveLength(20)
               })

Great! πŸ’«

@@ -38,6 +38,7 @@ The following features will be implemented. This gets done in three steps:

* Upload and Change Avatar
* Upload and Change Profile Picture
* Upload and Change Profile Header Image
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tirokk Authored by Tirokk
Jun 18, 2020


Outdated (history rewrite) - original diff


@@ -38,6 +38,7 @@ The following features will be implemented. This gets done in three steps:
 
 * Upload and Change Avatar
 * Upload and Change Profile Picture
+* Upload and Change Profile Header Image

Thanks very much that you thought about changing this doc as well. 😍

@@ -0,0 +1,18 @@
Feature: Upload UserProfile Header
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tirokk Authored by Tirokk
Jun 18, 2020


Outdated (history rewrite) - original diff


@@ -0,0 +1,18 @@
+Feature: Upload UserProfile Header

Hey, very good you add this e2e test! πŸ€—πŸ˜

Then I cannot upload a profile picture
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tirokk Authored by Tirokk
Jun 18, 2020


Outdated (history rewrite) - original diff


@@ -15,4 +15,4 @@ Feature: Upload UserProfile Image
   Scenario: Unable to change another user's avatar
     Given I am logged in with a "user" role
     And I visit another user's profile page
-    Then I cannot upload a picture
\ No newline at end of file
+    Then I cannot upload a profile picture

Cool you’ve clarified this as well! πŸ˜ŽπŸ‘πŸΌ

transition: all 0.2s ease-out;
font-size: 60px;

background-color: rgba(255, 255, 255, 0.7);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tirokk Authored by Tirokk
Jun 18, 2020


Outdated (history rewrite) - original diff


@@ -0,0 +1,224 @@
+<template>
+  <div class="profile-header">
+    <vue-dropzone
+      v-if="user && this.editable"
+      id="profileHeaderDropzone"
+      :key="profileHeaderUrl"
+      ref="el"
+      :use-custom-slot="true"
+      :options="dropzoneOptions"
+      @vdropzone-error="verror"
+    >
+      <div class="dz-message" @mouseover="hover = true" @mouseleave="hover = false">
+        <img
+          v-if="user && user.profileHeader"
+          :src="user.profileHeader | proxyApiUrl"
+          @error="$event.target.style.display = 'none'"
+          class="profile-header-image"
+          :alt="imageAlt"
+        />
+        <div class="profileHeader-attachments-upload-area">
+          <div class="profileHeader-drag-marker">
+            <base-icon v-if="hover" name="image" />
+          </div>
+        </div>
+      </div>
+    </vue-dropzone>
+    <div v-else>
+      <img
+        v-if="user && user.profileHeader"
+        :src="user.profileHeader | proxyApiUrl"
+        @error="$event.target.style.display = 'none'"
+        class="profile-header-image"
+        :alt="imageAlt"
+      />
+    </div>
+  </div>
+</template>
+
+<script>
+import vueDropzone from 'nuxt-dropzone'
+import { updateUserMutation } from '~/graphql/User.js'
+
+export default {
+  name: 'UserProfileHeader',
+  components: {
+    vueDropzone,
+  },
+  props: {
+    user: {
+      type: Object,
+      default: null,
+    },
+    editable: {
+      type: Boolean,
+      default: false,
+    },
+  },
+  data() {
+    return {
+      dropzoneOptions: {
+        url: this.vddrop,
+        maxFilesize: 5.0,
+        previewTemplate: this.template(),
+      },
+      error: false,
+      hover: false,
+    }
+  },
+  computed: {
+    imageAlt() {
+      if (!this.user && !this.user.name) return 'Profile header image'
+      return 'Profile header image of ' + this.user.name
+    },
+    profileHeaderUrl() {
+      const { profileHeader } = this.user
+      return profileHeader && profileHeader.url
+    },
+  },
+  watch: {
+    error() {
+      const that = this
+      setTimeout(function () {
+        that.error = false
+      }, 2000)
+    },
+  },
+  methods: {
+    template() {
+      return `<div class="dz-preview dz-file-preview">
+                <div class="dz-image">
+                  <div data-dz-thumbnail-bg></div>
+                </div>
+              </div>
+      `
+    },
+    vddrop(file) {
+      const profileHeaderUpload = file[0]
+      this.$apollo
+        .mutate({
+          mutation: updateUserMutation(),
+          variables: {
+            profileHeader: {
+              upload: profileHeaderUpload,
+            },
+            id: this.user.id,
+          },
+        })
+        .then(() => {
+          this.$toast.success(this.$t('user.profileHeader.submitted'))
+        })
+        .catch((error) => this.$toast.error(error.message))
+    },
+    verror(file, message) {
+      if (file.status === 'error') {
+        this.error = true
+        this.$toast.error(file.status, message)
+      }
+    },
+  },
+}
+</script>
+
+<style lang="scss">
+.profile-header {
+  height: 100%;
+  position: relative;
+  background-color: DarkGrey; /* Fallback color */
+}
+
+.profile-header-image {
+  position: absolute;
+  top: 0;
+  left: 0;
+  right: 0;
+  width: 100%;
+}
+
+#profileHeaderDropzone {
+  height: 100%;
+}
+
+.dz-message {
+  height: 100%;
+}
+
+#profileHeaderDropzone .dz-preview {
+  transition: all 0.2s ease-out;
+  width: 160px;
+  display: flex;
+}
+
+#profileHeaderDropzone .dz-preview .dz-image {
+  width: 100%;
+  height: 100%;
+  object-fit: contain;
+  overflow: hidden;
+}
+
+#profileHeaderDropzone .dz-preview .dz-image > div {
+  width: inherit;
+  height: inherit;
+  border-radius: 50%;
+  background-size: cover;
+}
+
+#profileHeaderDropzone .dz-preview .dz-image > img {
+  width: 100%;
+}
+
+.profileHeader-attachments-upload-area {
+  height: 100%;
+  position: relative;
+  display: flex;
+  align-items: center;
+  justify-content: center;
+  cursor: pointer;
+}
+
+.profileHeader-attachments-upload-button {
+  pointer-events: none;
+}
+
+.profileHeader-drag-marker {
+  position: relative;
+  width: 122px;
+  height: 122px;
+  border-radius: 100%;
+  display: flex;
+  align-items: center;
+  justify-content: center;
+  color: hsl(0, 0%, 25%);
+  transition: all 0.2s ease-out;
+  font-size: 60px;
+
+  background-color: rgba(255, 255, 255, 0.7);

All this is really cool dear! πŸ€—πŸ€
You haven even thought about 0.7! 😍

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DriesCruyskens Authored by DriesCruyskens
Jun 23, 2020


Yes I changed it because I didn't think it was visible enough depending on the chosen header image.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tirokk Authored by Tirokk
Jun 25, 2020


πŸ‘πŸΌ

"submitted": "Erfolgreich hochgeladen!"
"submitted": "Avatar-Bild erfolgreich hochgeladen!"
},
"profileHeader": {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tirokk Authored by Tirokk
Jun 19, 2020


Outdated (history rewrite) - original diff


@@ -830,6 +830,9 @@
   "user": {
     "avatar": {
       "submitted": "Erfolgreich hochgeladen!"
+    },
+    "profileHeader": {
+      "submitted": "Erfolgreich hochgeladen!"
     }

May we can use one identifier for both cases if we show the same text?
like this:

"image": {
  "submitted": "Erfolgreich hochgeladen!β€œ
}

Or we do different texts as example:

  • Avatar-Bild erfolgreich hochgeladen!
  • Profilbild erfolgreich hochgeladen!

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DriesCruyskens Authored by DriesCruyskens
Jun 23, 2020


I'll do the different texts one since it is better to letter the user know exactly what has changed to eliminate any confusion.

"submitted": "Upload successful!"
"submitted": "Avatar upload successful!"
},
"profileHeader": {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tirokk Authored by Tirokk
Jun 19, 2020


Outdated (history rewrite) - original diff


@@ -830,6 +830,9 @@
   "user": {
     "avatar": {
       "submitted": "Upload successful!"
+    },
+    "profileHeader": {
+      "submitted": "Upload successful!"
     }

Same same ☝🏼

"submitted": "Carga con Γ©xito"
"submitted": "Carga de foto de perfil exitoso!"
},
"profileHeader": {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tirokk Authored by Tirokk
Jun 19, 2020


Outdated (history rewrite) - original diff


@@ -827,6 +827,9 @@
   "user": {
     "avatar": {
       "submitted": "Carga con Γ©xito"
+    },
+    "profileHeader": {
+      "submitted": "Carga con Γ©xito!"
     }

Same same ☝🏼

"submitted": "TΓ©lΓ©chargement rΓ©ussi"
"submitted": "TΓ©lΓ©chargement d'image de profil rΓ©ussi!"
},
"profileHeader": {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tirokk Authored by Tirokk
Jun 19, 2020


Outdated (history rewrite) - original diff


@@ -791,6 +791,9 @@
   "user": {
     "avatar": {
       "submitted": "TΓ©lΓ©chargement rΓ©ussi"
+    },
+    "profileHeader": {
+      "submitted": "TΓ©lΓ©chargement rΓ©ussi"
     }

Same same ☝🏼

"submitted": ""
"submitted": "Caricamento dell'immagine del profilo eseguito correttamente!"
},
"profileHeader": {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tirokk Authored by Tirokk
Jun 19, 2020


Outdated (history rewrite) - original diff


@@ -734,6 +734,9 @@
   "user": {
     "avatar": {
       "submitted": ""
+    },
+    "profileHeader": {
+      "submitted": "Caricamento eseguito correttamente!"
     }

Same same ☝🏼

"user": {
"avatar": {
"submitted": "Uploaden van profielfoto geslaagd!"
},
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tirokk Authored by Tirokk
Jun 19, 2020


Outdated (history rewrite) - original diff


@@ -172,5 +172,10 @@
     "taxident": "Identificatienummer voor de belasting over de toegevoegde waarde overeenkomstig Β§ 27 a Wet op de belasting over de toegevoegde waarde (Duitsland).",
     "termsAc": "Gebruiksvoorwaarden",
     "tribunal": "registerrechtbank"
+  },
+  "user": {
+    "profileHeader": {
+      "submitted": "Uploaden geslaagd!"
+    }

Same same ☝🏼

But here the avatar is missing …

"submitted": "PrzesΕ‚ano pomyΕ›lnie"
"submitted": "Obraz awatara WysyΕ‚anie zakoΕ„czone!"
},
"profileHeader": {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tirokk Authored by Tirokk
Jun 19, 2020


Outdated (history rewrite) - original diff


@@ -363,6 +363,9 @@
   "user": {
     "avatar": {
       "submitted": "PrzesΕ‚ano pomyΕ›lnie"
+    },
+    "profileHeader": {
+      "submitted": "PrzesΕ‚ano pomyΕ›lnie"
     }

Same same ☝🏼

"submitted": "Carregado com sucesso!"
"submitted": "Imagem de avatar upload bem sucedido!"
},
"profileHeader": {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tirokk Authored by Tirokk
Jun 19, 2020


Outdated (history rewrite) - original diff


@@ -722,6 +722,9 @@
   "user": {
     "avatar": {
       "submitted": "Carregado com sucesso!"
+    },
+    "profileHeader": {
+      "submitted": "Carregado com sucesso!"
     }

Same same ☝🏼

"submitted": "УспСшная Π·Π°Π³Ρ€ΡƒΠ·ΠΊΠ°!"
"submitted": "Аватара Π·Π°Π³Ρ€ΡƒΠ·ΠΊΠ° ΠΏΡ€ΠΎΡˆΠ»Π° ΡƒΡΠΏΠ΅ΡˆΠ½ΠΎ!"
},
"profileHeader": {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tirokk Authored by Tirokk
Jun 19, 2020


Outdated (history rewrite) - original diff


@@ -823,6 +823,9 @@
   "user": {
     "avatar": {
       "submitted": "УспСшная Π·Π°Π³Ρ€ΡƒΠ·ΠΊΠ°!"
+    },
+    "profileHeader": {
+      "submitted": "УспСшная Π·Π°Π³Ρ€ΡƒΠ·ΠΊΠ°!"
     }

Same same ☝🏼

@Tirokk
Copy link
Member Author

Tirokk commented Oct 7, 2020

DriesCruyskens Authored by DriesCruyskens
Jun 23, 2020


@Tirokk I implemented the changes you requested, everything should be OK now. For the locales tho, the English, German, French and Dutch ones are certainly correct but I translated the remaining ones using Google translate so I'm not too sure about them.

position: absolute;
top: 0;
left: 0;
right: 0;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tirokk Authored by Tirokk
Jun 25, 2020


Outdated (history rewrite) - original diff


@@ -169,7 +164,10 @@ export default {
 
 .profileHeader-attachments-upload-area {
   height: 100%;
-  position: relative;
+  position: absolute;
+  top: 0;
+  left: 0;
+  right: 0;

The last changes here and/or in webapp/pages/profile/_id/_slug.vue made the whole header image area and dropZone invisible, unfortunately.

I haven’t investigated why. 😬

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DriesCruyskens Authored by DriesCruyskens
Jun 25, 2020


I yes, I went a little too fast there. Was so focused on getting the profile header right I forgot to check how it looked when no header present.. my bad. Should all be good now (if tests succeed). proof:

fix

I'm using CSS variables with different values depending on the presence of the header image.

  • Header image: allow a small shrink to prevent the grey bar using min- and max-height.
  • No header image: fixed height of 250px;

When uploading tho you can see a short visible glitch/shrink of the header. I tried setting a fallback height of 250px in css (for when the css variables don't come through) but this didn't help. Any idea what causes this or how to fix it?

@@ -242,6 +246,7 @@ import { muteUser, unmuteUser } from '~/graphql/settings/MutedUsers'
import { blockUser, unblockUser } from '~/graphql/settings/BlockedUsers'
import PostMutations from '~/graphql/PostMutations'
import UpdateQuery from '~/components/utils/UpdateQuery'
import UserProfileHeader from '~/components/_new/generic/UserProfileHeader/UserProfileHeader'
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tirokk Authored by Tirokk
Jun 25, 2020


Outdated (history rewrite) - original diff


@@ -550,8 +550,8 @@ export default {
   }
 }
 
-.profile-header {
+.profile-header-card {
   padding: 0px; /* Overwrite default card padding to 0. */
-  height: 250px;
+  max-height: 250px;

The last changes here and/or in webapp/pages/profile/_id/_slug.vue made the whole header image area and dropZone invisible, unfortunately.

I haven’t investigated why. 😬

<ds-flex v-if="user" :width="{ base: '100%' }" gutter="base">
<ds-flex-item width="100%">
<base-card class="profile-header-card">
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tirokk Authored by Tirokk
Jun 25, 2020


Outdated (history rewrite) - original diff


@@ -2,7 +2,7 @@
   <div>
     <ds-flex v-if="user" :width="{ base: '100%' }" gutter="base">
       <ds-flex-item width="100%">
-        <base-card class="profile-header">
+        <base-card class="profile-header-card">

This change has broken the Cypress test …

I allowed myself to fix this. Hope this is okay for you @DriesCruyskens !?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DriesCruyskens Authored by DriesCruyskens
Jun 25, 2020


yes off course! my bad

cy.get(".base-card")
.children()
.should("not.have.id", "profileHeaderDropzone")
.should("have.class", "profile-header");
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DriesCruyskens Authored by DriesCruyskens
Jun 26, 2020


Outdated (history rewrite) - original diff


@@ -28,9 +46,17 @@ When("I visit another user's profile page", () => {
   cy.openPage("profile/peter-pan");
 });
 
-Then("I cannot upload a picture", () => {
+Then("I cannot upload a profile picture", () => {
   cy.get(".base-card")
     .children()
     .should("not.have.id", "customdropzone")
     .should("have.class", "user-avatar");
 });
+
+
+Then("I cannot upload a profile header image", () => {
+  cy.get(".base-card")
+    .children()
+    .should("not.have.id", "profileHeaderDropzone")
+    .should("have.class", "profile-header-card");

I suspect the fix you did changing profile-header to profile-header-card was wrong after all and the errors you thought it caused had in fact different causes. Since this test finds the element with .base-card class and then analyzes its children, its easy to see why it can't find profile-header-card. The test in its original state was in fact checking the child with the profile-header class:

image

tldr; The error regarding this test should be fixed by changing line 61 back to

Suggested change
.should("have.class", "profile-header");
.should("have.class", "profile-header");

@Tirokk
Copy link
Member Author

Tirokk commented Oct 7, 2020

Tirokk Authored by Tirokk
Jul 8, 2020


Hey @DriesCruyskens ,

thanks for investigating the error. πŸ™πŸΌ
I took spontaneously holidays and am now back to work.
In the next days I have not to much time, but will try to figure out the problem!

@Tirokk
Copy link
Member Author

Tirokk commented Oct 7, 2020

Tirokk Authored by Tirokk
Aug 10, 2020


On this cool feature we have an error in the tests.
If you could care for this one when you can’t find any motivation but work on tests @Mogge that would be really nice. 😘

I couldn't find it out so quickly …

Copy link
Contributor

@Mogge Mogge left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You did an impressive work @DriesCruyskens !!!

We really appreciate to have you contributing here. 😍
And I enjoyed your clarifying extra notes very much.
Thanks a lot again for your effort! πŸ™πŸΌ

All what you lay out there I hope I have answered in my comments.
That you added not storybook entry is fine I think.

Only some little change requests …

With the behaviour on mobil screens I would say Β»a max-height depending on the height of the image so no grey background is visibleΒ« like you suggested would be a nice solution. πŸ€—

Copy link
Contributor

@Mogge Mogge left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately two errors slipped in. @DriesCruyskens
😬

I allowed myself to fix the Cypress test on your branch.

But afterwards I found out that the profile image area with the dropZone is missing at all.
In FireFox and Safari on my Mac.

As I reverted your last changes in webapp/components/_new/generic/UserProfileHeader/UserProfileHeader.vue and webapp/pages/profile/_id/_slug.vue. Suddenly it appeared again.

Would be nice if you could investigate, dear.
Anything else seems to be fine for me.

Nice that you already did the translation! That’s for sure good a start. 😍
In general we use
https://lokalise.co/public/556252725c18dd752dd546.13222042/
for users to help us with translations.

Thanks a lot for your effort! πŸ€—

@Tirokk Tirokk changed the title feat: 🍰 display, select and upload UserProfile header image feat: 🍰 Display, Select And Upload UserProfile Header Image Oct 22, 2022
@Tirokk Tirokk changed the base branch from pr3634base to master October 22, 2022 13:49
@Tirokk Tirokk marked this pull request as draft February 21, 2023 18:54
@Tirokk Tirokk changed the title feat: 🍰 Display, Select And Upload UserProfile Header Image feat: 🍰 Webapp, Backend – User Profile – Display, Select And Upload UserProfile Header Image Mar 20, 2023
@Tirokk Tirokk changed the title feat: 🍰 Webapp, Backend – User Profile – Display, Select And Upload UserProfile Header Image feat: 🍰 Webapp, Backend – User Profile – Display, Select and Upload User Profile Header Image Mar 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

πŸš€ [Feature] Display, select and upload UserProfile Header Image
4 participants