1
0
Fork 0
mirror of https://github.com/voltbonn/profile-picture-generator.git synced 2024-12-22 15:55:08 +00:00

added locale specific hashtags and added linebreaks between them

This commit is contained in:
thomasrosen 2021-04-21 02:25:58 +02:00
parent aaed8c6d6f
commit 33e8da028d
3 changed files with 76 additions and 28 deletions

View file

@ -7,42 +7,39 @@ function HashtagChooser({ onChange, getString }) {
const choosenFrameSRC = !!choosenFrame ? choosenFrame.src : null const choosenFrameSRC = !!choosenFrame ? choosenFrame.src : null
let hashtags = getString('hashtags')
useEffect(() => { useEffect(() => {
async function loadFrames() { async function loadFrames() {
console.log('hashtags', hashtags)
let counter = 0
hashtags = hashtags.split('\n')
.map(tag => tag.trim())
.map(tag => {
if (tag === '-') {
counter += 1
return '---' + counter
}
return tag
})
.filter(tag => tag.length > 0)
console.log('hashtags', hashtags)
Promise.all( Promise.all(
[ [
'', '',
'#VoteVolt', '---',
'#JoinTheChange', ...hashtags
'#RejoinEU',
'#DeineWahl',
'#JetztBistDuDran',
'#VoltEuropa',
'#VoltRLP',
'#Volt21',
'#Volt',
'#paneuropäisch',
'#pragmatisch',
'#progressiv',
'#Europa',
'#democracy',
'#EUReform',
'#European',
'#EuropeCares',
'#FutureMadeInEurope',
'#ValuesOverPower',
'#ZukunftMadeInEurope',
'#IkStemVolt',
'stemvolt.nl',
'#VoltForLGBTIAQ',
] ]
.map(async frame_filename => { .map(async frame_filename => {
let src = frame_filename
if (frame_filename !== '' && !frame_filename.startsWith('---')) {
src = (await import(`./hashtags/${frame_filename}.png`)).default
}
return { return {
name: frame_filename, name: frame_filename,
src: frame_filename === '' ? '' : (await import(`./hashtags/${frame_filename}.png`)).default, src
} }
}) })
) )
@ -52,7 +49,7 @@ function HashtagChooser({ onChange, getString }) {
}) })
} }
loadFrames() loadFrames()
}, []) }, [hashtags])
const handleImageChoosing = useCallback(frame => { const handleImageChoosing = useCallback(frame => {
setChoosenFrame(frame) setChoosenFrame(frame)
@ -68,6 +65,9 @@ function HashtagChooser({ onChange, getString }) {
frames.map(frame => { frames.map(frame => {
const frame_src_path = frame.src const frame_src_path = frame.src
const isChoosen = choosenFrameSRC === frame_src_path const isChoosen = choosenFrameSRC === frame_src_path
if (frame_src_path.startsWith('---')) {
return <div key={frame_src_path} style={{height: '1vmin'}} />
}
return <button return <button
key={frame.name} key={frame.name}
data-src={frame_src_path} data-src={frame_src_path}

View file

@ -20,3 +20,26 @@ link_imprint = Impressum
link_privacy_policy = Datenschutz link_privacy_policy = Datenschutz
link_source_code = Quellcode link_source_code = Quellcode
link_app_contact = Kontakt link_app_contact = Kontakt
hashtags =
#VoteVolt
#JoinTheChange
#VoltEuropa
#Volt
-
#DeineWahl
#JetztBistDuDran
#Volt21
-
#paneuropäisch
#pragmatisch
#progressiv
#Europa
#democracy
#EUReform
#European
#EuropeCares
#VoltForLGBTIAQ
#ValuesOverPower
-
#ZukunftMadeInEurope

View file

@ -20,3 +20,28 @@ link_imprint = Imprint
link_privacy_policy = Privacy Policy link_privacy_policy = Privacy Policy
link_source_code = Source Code link_source_code = Source Code
link_app_contact = Contact link_app_contact = Contact
hashtags =
#VoteVolt
#JoinTheChange
#VoltEuropa
#Volt
-
#RejoinEU
#Volt21
#IkStemVolt
-
#progressiv
#democracy
#Europa
#EUReform
#European
#EuropeCares
#VoltForLGBTIAQ
#ValuesOverPower
-
#FutureMadeInEurope
not_in_use_hashtags =
#VoltRLP
stemvolt.nl