Skip to content
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

Fix/various design #1792

Merged
merged 5 commits into from
Sep 8, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 0 additions & 65 deletions css/Settings/SettingsAddressbook.scss

This file was deleted.

1 change: 0 additions & 1 deletion css/contacts.scss
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ $grid-input-height-with-margin: $grid-height-unit - $grid-input-margin * 2;

// components
@import 'SettingsSection';
@import 'Settings/SettingsAddressbook';
@import 'Settings/SettingsAddressbookShares';
@import 'Settings/SettingsAddressbookSharee';
@import 'ContactsListItem';
Expand Down
6 changes: 3 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"stylelint:fix": "stylelint src --fix"
},
"dependencies": {
"@mattkrick/sanitize-svg": "^0.2.1",
"@mattkrick/sanitize-svg": "^0.3.0",
"@nextcloud/auth": "^1.3.0",
"@nextcloud/axios": "^1.4.0",
"@nextcloud/dialogs": "^2.0.1",
Expand Down
18 changes: 1 addition & 17 deletions src/components/ContactDetails/ContactDetailsAvatar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -236,8 +236,7 @@ export default {
if (e.target.result.indexOf('image/svg') > -1) {
const imageSvg = atob(imageBase64)
const cleanSvg = await sanitizeSVG(imageSvg)
// TODO: replace haveUnsafeSvgEvents with https://github.com/mattkrick/sanitize-svg/pull/2
if (!cleanSvg || self.haveUnsafeSvgEvents(imageSvg)) {
if (!cleanSvg) {
throw new Error('Unsafe svg image', imageSvg)
}
}
Expand All @@ -262,21 +261,6 @@ export default {
}
},

/**
* Does the provided svg have unsafe js events
* @param {string} svgText the svg as string
* @returns {boolean}
*/
haveUnsafeSvgEvents(svgText) {
const div = window.document.createElement('div')
div.innerHTML = svgText

const svgEl = div.firstElementChild
const attributes = [].slice.call(svgEl.attributes) || []
const events = attributes.filter(attr => attr.name.indexOf('on') === 0)
return events.length !== 0
},

/**
* Reset image pciker input
*/
Expand Down
3 changes: 0 additions & 3 deletions src/components/EntityPicker/EntityBubble.vue
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,6 @@ export default {
}

.entity-picker__bubble {
// Add space between bubbles
margin-right: 4px;
display: flex;

&-delete {
Expand All @@ -111,5 +109,4 @@ export default {
}
}
}

</style>
26 changes: 19 additions & 7 deletions src/components/EntityPicker/EntityPicker.vue
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ export default {

// Dialog variables
$dialog-margin: 20px;
$dialog-width: 300px;
$dialog-width: 320px;
$dialog-height: 480px;
$entity-spacing: 4px;

Expand All @@ -317,10 +317,11 @@ $icon-margin: ($clickable-area - $icon-size) / 2;
the margin applied to the content is added to the total modal width,
so here we subtract it to the width and height of the content.
*/
width: $dialog-width - $dialog-margin * 2;
height: $dialog-height - $dialog-margin * 2;
width: $dialog-width;
max-width: 100vw;
height: $dialog-height;
max-height: calc(100vh - #{$dialog-margin} * 2 - 10px);
margin: $dialog-margin;
max-height: calc(100vh - $dialog-margin * 2 - 10px);

&__search {
position: relative;
Expand All @@ -329,10 +330,10 @@ $icon-margin: ($clickable-area - $icon-size) / 2;
&-input {
width: 100%;
height: $clickable-area - $entity-spacing !important;
margin: $entity-spacing 0;
padding-left: $clickable-area;
font-size: 16px;
line-height: $clickable-area - $entity-spacing;
margin: $entity-spacing 0;
}
&-icon {
position: absolute;
Expand All @@ -345,19 +346,26 @@ $icon-margin: ($clickable-area - $icon-size) / 2;
display: flex;
overflow-y: auto;
align-content: flex-start;
justify-content: space-between;
flex: 1 0 auto;
flex-wrap: wrap;
// half a line height to know there is more lines
max-height: 6.5em;
padding: $entity-spacing 0;
border-bottom: 1px solid var(--color-background-darker);
background: var(--color-main-background);

// Allows 2 per line
.entity-picker__bubble {
flex: 0 1 50%;
max-width: calc(50% - #{$entity-spacing});
}
}

&__options {
margin: $entity-spacing 0;
overflow-y: auto;
flex: 1 1 100%;
margin: $entity-spacing 0;
}

&__navigation {
Expand All @@ -367,12 +375,16 @@ $icon-margin: ($clickable-area - $icon-size) / 2;
flex: 0 0;
justify-content: space-between;
// Same as above
width: $dialog-width - $dialog-margin * 2;
width: 100%;
box-shadow: 0 -10px 5px var(--color-main-background);
&__button-right {
margin-left: auto;
}
}

&::v-deep &__bubble {
margin-bottom: $entity-spacing;
}
}

// Properly center Entity Picker empty content
Expand Down
3 changes: 2 additions & 1 deletion src/components/ProcessingScreen.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template>
<EmptyContent class="processing-screen__wrapper" icon="icon-contacts">
<EmptyContent class="processing-screen__wrapper" icon="icon-contacts-dark">
<slot />
<template #desc>
<div class="processing-screen__progress">
Expand Down Expand Up @@ -62,6 +62,7 @@ export default {
&__desc {
display: inline-flex;
align-items: center;
width: 100%;
margin-top: 22px;
color: var(--color-text-maxcontrast);

Expand Down
47 changes: 46 additions & 1 deletion src/components/Settings/SettingsAddressbook.vue
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<template>
<li :class="{'addressbook--disabled': !addressbook.enabled}" class="addressbook">
<!-- addressbook name -->
<span class="addressbook__name">
<span class="addressbook__name" :title="addressbook.displayName">
{{ addressbook.displayName }}
</span>

Expand Down Expand Up @@ -278,3 +278,48 @@ export default {
},
}
</script>

<style lang="scss" scoped>
.addressbook {
display: flex;
flex-wrap: wrap;
align-items: center;
white-space: nowrap;
text-overflow: ellipsis;

> .addressbook__name {
+ a,
+ div {
// put actions at the end
margin-left: auto;
}
}

&__name {
display: block;
flex: 0 1 auto;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
&__share,
&__menu .icon-more {
width: 44px;
height: 44px;
opacity: .5;
&:hover,
&:focus,
&:active {
opacity: .7;
}
}
&__share {
&--shared {
opacity: .7;
}
}
&--disabled &__name {
opacity: .5;
}
}
</style>
11 changes: 7 additions & 4 deletions src/components/Settings/SettingsImportContacts.vue
Original file line number Diff line number Diff line change
Expand Up @@ -196,12 +196,14 @@ export default {

const file = event.target.files[0]
const reader = new FileReader()
const selectedAddressbook = this.selectedAddressbook

const addressbook = this.selectedAddressbook
this.$store.dispatch('setAddressbook', addressbook.displayName)

const self = this
reader.onload = function(e) {
self.isOpened = false
self.$store.dispatch('importContactsIntoAddressbook', { vcf: reader.result, addressbook: selectedAddressbook })
self.$store.dispatch('importContactsIntoAddressbook', { vcf: reader.result, addressbook })

// reset input
event.target.value = ''
Expand All @@ -223,11 +225,12 @@ export default {
cancelToken: source.token,
})

const addressbook = this.selectedAddressbook
this.$store.dispatch('changeStage', 'parsing')
this.$store.dispatch('setAddressbook', this.selectedAddressbook.displayName)
this.$store.dispatch('setAddressbook', addressbook.displayName)

if (file.data) {
await this.$store.dispatch('importContactsIntoAddressbook', { vcf: file.data, addressbook: this.selectedAddressbook })
await this.$store.dispatch('importContactsIntoAddressbook', { vcf: file.data, addressbook })
}
} catch (error) {
console.error('Something wrong happened while processing local file', error)
Expand Down
7 changes: 6 additions & 1 deletion src/services/parseVcf.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,12 @@ export default function parseVcf(data = '', addressbook) {
const vCards = data.match(regexp)

if (!vCards) {
console.error('Error during the parsing of the following vcf file: ', data)
console.error('Error during the parsing of the following vcf file', data)
return []
}

if (!addressbook) {
console.error('Invalid addressbook', addressbook)
return []
}

Expand Down
1 change: 1 addition & 0 deletions src/store/addressbooks.js
Original file line number Diff line number Diff line change
Expand Up @@ -407,6 +407,7 @@ const actions = {

// create the array of requests to send
contacts.map(async contact => {
console.info(contact)

// Get vcard string
try {
Expand Down
Loading