Skip to content

Commit

Permalink
feat(profile): remove photo when user already uploaded (#3998)
Browse files Browse the repository at this point in the history
  • Loading branch information
nathan-power committed Jul 15, 2022
1 parent fbd09d1 commit 851c99a
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 3 deletions.
3 changes: 3 additions & 0 deletions components/views/settings/pages/profile/Profile.html
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@
/>
</div>
</div>
<button class="remove-button" @click="removeProfileImage">
<span>{{ $t('pages.settings.profile.remove_image') }}</span>
</button>
<div class="username">
<TypographyTitle :size="6" :text="accounts.details.name" />
</div>
Expand Down
31 changes: 28 additions & 3 deletions components/views/settings/pages/profile/Profile.less
Original file line number Diff line number Diff line change
Expand Up @@ -30,19 +30,29 @@
.profile-section {
display: grid;
grid-template-columns: auto 1fr 1fr 1fr;
grid-template-rows: 1fr 1fr 1fr;
grid-template-rows: auto 1fr auto 1fr;
gap: 0px 0px;
grid-template-areas:
'subtitle subtitle subtitle subtitle'
'photo username username username'
'remove-button . . .'
'status-input status-input status-input status-input';
}

.subtitle {
margin-bottom: @light-spacing;
}

.photo {
align-self: center;
margin: 0 @normal-spacing @xlight-spacing 0;
}

.remove-button {
margin-left: 0.3rem;
margin-top: 0;
}

.status-input {
align-self: center;
}
Expand Down Expand Up @@ -115,12 +125,13 @@
.profile-section {
display: grid;
grid-template-columns: 0.3fr 1fr 1fr;
grid-template-rows: 0.5fr 0.5fr 0.5fr;
grid-template-rows: 0.5fr 0.5fr 0.5fr auto;
gap: 0px 16px;
grid-template-areas:
'subtitle subtitle subtitle'
'photo username username'
'photo status-input status-input';
'photo status-input status-input'
'remove-button . .';
}

.subtitle {
Expand All @@ -131,6 +142,15 @@
grid-area: photo;
}

.remove-button {
display: flex;
grid-area: remove-button;
margin-top: @xlight-spacing;
margin-left: 1.1rem;
font-size: @mini-text-size;
&:extend(.color-danger);
}

.username {
align-self: center;
grid-area: username;
Expand All @@ -147,16 +167,19 @@

.profile-photo-column {
max-width: 100px;

.profile-photo {
position: relative;
height: @size;
width: @size;
cursor: pointer;

.is-rounded,
.is-square {
max-width: @full !important;
max-height: @full !important;
}

.plus-button {
&:extend(.first-layer);
right: 0;
Expand Down Expand Up @@ -248,9 +271,11 @@
left: 0;
right: 0;
top: 0;

.content {
position: relative;
width: 500px;

.cropper-mask {
&:extend(.blur-less);
position: fixed;
Expand Down
5 changes: 5 additions & 0 deletions components/views/settings/pages/profile/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,11 @@ export default Vue.extend({
reader.readAsDataURL(files[0])
}
},
removeProfileImage() {
this.croppedImage = ''
// TODO: Update with IPFS method
// this.$store.dispatch('accounts/updateProfilePhoto', '')
},
},
})
</script>
Expand Down
1 change: 1 addition & 0 deletions locales/en-US.js
Original file line number Diff line number Diff line change
Expand Up @@ -499,6 +499,7 @@ export default {
title: 'Profile',
subtitle: 'Update your profile photo, status, banners and more.',
status_placeholder: 'Some super interesting status message',
remove_image: 'Remove',
info: {
title: 'Account Info',
subtitle:
Expand Down

0 comments on commit 851c99a

Please sign in to comment.