Updates result with default logo display

This commit is contained in:
Moritz Kröger 2019-04-26 10:22:32 +01:00
parent 7b2d8cbf44
commit a2efd921d5
14 changed files with 76 additions and 60 deletions

View file

@ -1,4 +1,4 @@
const { SUPPORTED_LOCALES } = require('../src/config')
const { SUPPORTED_LOCALES } = require('../../src/config')
const createField = (widget, name, label, opts) => ({ label, name, widget, ...opts })

View file

@ -629,8 +629,8 @@ collections:
- label: '[Label] About us'
name: about
widget: string
- label: '[Label] Press'
name: press
- label: '[Label] Contact'
name: contact
widget: string
- label: Footer Navigation
name: footerMenu

View file

@ -14,11 +14,14 @@
<router-link :to="{ path: getPartyPath(party.token.toLowerCase()) }">
<div class="result-party-info">
<div class="result-party-logo">
<img :src="getPartyLogo(party.token)"
<img
v-if="hasPartyLogo(party.token)"
:src="getPartyLogo(party.token)"
width="50"
height="50"
:alt="party.token"
>
<span v-else>{{ party.token }}</span>
</div>
<h2>{{ getScorePercentage(party.score) }}%</h2>
@ -134,7 +137,15 @@
return require(`@/assets/svg/${token.toLowerCase().replace(/\s/g, '-')}-logo.svg`)
} catch (error) {
console.warn(`No logo found for party "${token}", falling back to initials.`, error.message)
return ''
return false
}
},
hasPartyLogo (token) {
try {
require(`@/assets/svg/${token.toLowerCase().replace(/\s/g, '-')}-logo.svg`)
return true
} catch (error) {
return false
}
},
getScorePercentage (score) {
@ -333,6 +344,11 @@
img {
object-fit: contain;
}
span {
color: $text-color-invert;
font-weight: 700;
}
}
}

View file

@ -1,10 +0,0 @@
/* eslint-disable */
var icon = require('vue-svgicon')
icon.register({
'cdu-logo': {
width: 750,
height: 230,
viewBox: '0 0 750 230',
data: '<path pid="0" d="M218 64l8-49C-59-55-69 278 201 211l7-49C8 206 59 9 218 64zM259 10l-32 207h144c114 0 155-207 12-207zm62 45h44c61 0 42 117-14 117h-47z" _fill="#ba261d"/><path pid="1" d="M511 10h73l-18 117c-9 52 73 69 86-1l17-116h71l-19 124c-25 127-250 109-226-10z" _fill="#ba261d"/>'
}
})

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -1,20 +1,20 @@
/* eslint-disable */
require('./alde-logo')
require('./cdu-logo')
require('./diem25-logo')
require('./edp-logo')
require('./egp-logo')
require('./euromat-logo')
require('./european-left-logo')
require('./european-stars')
require('./fdp-logo')
require('./flag-de')
require('./flag-dk')
require('./flag-en')
require('./flag-fr')
require('./flag-pl')
require('./grune-logo')
require('./linke-logo')
require('./pes-logo')
require('./pirates-logo')
require('./poe-colored-logo')
require('./poe-logo')
require('./polis-colored-logo')
require('./polis-logo')
require('./spd-logo')
require('./star')

View file

@ -1,10 +0,0 @@
/* eslint-disable */
var icon = require('vue-svgicon')
icon.register({
'linke-logo': {
width: 566.929,
height: 127.057,
viewBox: '0 0 566.929 127.057',
data: '<g fill-rule="evenodd"><path pid="0" d="M547.424 127.057c9.143 0 17.836-7.231 19.285-16.341 1.54-9.687-5.171-16.773-14.602-16.773-8.563 0-17.158 7.52-18.56 16.34-1.472 9.255 4.587 16.774 13.877 16.774zm-80.358-1.592h52.248l3.888-25.737h-24.127l2.512-16.629h21.644l3.888-25.737h-21.646l2.292-15.184h24.127l3.887-25.737h-52.25l-16.463 109.024zm-5.44 0l-16.574-56.392 30.42-52.632h-29.639l-22.45 46.415 6.871-46.415h-28.122l-16.465 109.024h28.125l7.553-50.028 10.092 50.028h30.189zm-160.443 0h27.02l4.826-31.954c1.55-10.269 1.839-20.39 2.7-30.655l11.776 62.61h27.019L390.989 16.44h-27.02l-4.193 27.762c-1.9 12.579-1.71 25.013-2.508 37.594L344.393 16.44h-26.745l-16.465 109.024zm-49.619 0l3.885-25.737h-21.093l12.578-83.287h-28.122l-16.465 109.024h49.217zm-132.04 0h52.248l3.887-25.737h-24.125l2.512-16.629h21.644l3.887-25.737H157.93l2.294-15.184h24.125l3.888-25.737h-52.249l-16.465 109.024zm-11.197 0L124.79 16.441H96.667L80.202 125.465h28.125zm-67.843-81.84c12.82 0 12.537 16.484 10.747 28.341-1.55 10.266-6.29 27.039-19.132 27.182l8.385-55.522zM0 125.466h24.54c17.095 0 47.985-4.626 55.584-54.946 4.977-32.968-9.067-54.078-41.05-54.078H16.466L0 125.465zm289.809 0l13.87-89.067h-28.122l-13.873 89.067h28.125z"/><path pid="1" _fill="#dc0000" d="M309.336 0l-54.314 16.418 49.508 14.55z"/></g>'
}
})

View file

@ -0,0 +1,10 @@
/* eslint-disable */
var icon = require('vue-svgicon')
icon.register({
'pes-logo': {
width: 602.362,
height: 744.059,
viewBox: '0 0 602.362 744.059',
data: '<path pid="0" d="M17.716 17.72v566.93h141.447L301.17 726.338V584.65h283.476V17.72" _fill="red"/><path pid="1" d="M471.839 59.15c-21.627.03-41.826 7.364-54.446 19.66-9.748 9.725-16.652 22.369-16.637 37.432-.023 15.578 5.543 28.07 14.368 36.865 8.817 8.81 20.803 13.967 33.65 16.069 12.168 2.057 27.753 2.692 39.512 4.915 5.188.938 9.921 2.775 13.234 5.672 3.304 2.934 5.444 6.715 5.482 12.477-.007 3.94-.832 6.64-1.89 8.885-1.051 2.246-2.413 3.993-4.349 6.05-5.74 6.072-16.938 8.734-28.924 8.696-9.982.03-21.28-2.087-27.79-8.696-4.803-4.794-8.523-11.79-8.508-19.661V184.3H396.22v3.214c.023 17.83 8.534 33.54 19.661 43.67 15.396 14.035 36.162 19.276 55.58 19.283 22.407-.015 44.132-5.596 58.606-20.04 9.316-9.263 15.721-22.125 15.691-39.51.023-16.01-5.981-28.842-15.502-38-9.52-9.172-22.421-14.67-36.297-16.636-11.722-1.527-27.594-2.798-38.756-4.537-4.87-.81-8.719-2.503-11.343-5.104-2.609-2.617-4.136-6.201-4.159-11.343.046-5.838 1.71-9.354 5.105-13.045 6.321-6.616 17.173-8.908 26.845-8.885 4.423 0 9.43.923 13.99 2.458 4.56 1.512 8.59 3.735 10.964 6.238 3.811 3.985 6.821 10.345 6.995 15.691l.19 2.836h39.321v-3.025c-.28-15.88-8.076-29.779-19.094-40.267h-.189c-12.877-12.031-32.199-18.126-51.988-18.149zM67.65 62.362v184.89h38.377v-64.087h34.596c21.098.007 37.848-5.899 49.153-16.637 11.313-10.73 17.03-26.089 17.014-43.86.016-17.77-5.694-33-17.014-43.67-11.313-10.67-28.063-16.651-49.153-16.636H67.651zm171.09 0v184.89H372.21v-35.73h-94.903v-42.725h83.56v-35.352h-83.56V97.904h94.903V62.363H238.74zM106.028 96.959h33.462c10.314.008 17.271 2.783 21.74 7.184 4.455 4.408 6.602 10.7 6.617 18.716-.015 8.016-2.17 14.375-6.617 18.716-4.446 4.34-11.418 6.98-21.74 6.994h-33.462V96.96z" _fill="#fff"/>'
}
})

File diff suppressed because one or more lines are too long

View file

@ -1,10 +0,0 @@
/* eslint-disable */
var icon = require('vue-svgicon')
icon.register({
'spd-logo': {
width: 500,
height: 500,
viewBox: '0 0 340 340',
data: '<path pid="0" _fill="#E2001A" d="M0 0h340v340H0z"/><path pid="1" d="M87 239l13-20c-72-40-106 47-41 58 32 5 4 32-26 6l-13 22c74 49 122-49 46-56-16-1-17-26 21-10z" _fill="#fff"/><path pid="2" d="M110 210v105h30v-35h23c37 0 38-71 0-70h-53zm30 23h12c13 0 13 25 0 25h-12v-25z" _fill="#fff" fill-rule="evenodd"/><path pid="3" d="M198 210v105h46c59 1 59-105 1-105h-47zm29 25h5c37 0 37 56 0 56h-5v-56z" _fill="#fff" fill-rule="evenodd"/>'
}
})