From 33e8da028da2ac201fb94102183eaf7512fd1ae4 Mon Sep 17 00:00:00 2001 From: thomasrosen Date: Wed, 21 Apr 2021 02:25:58 +0200 Subject: [PATCH] added locale specific hashtags and added linebreaks between them --- src/HashtagChooser.js | 56 +++++++++++++++++++++---------------------- src/locales/de.ftl | 23 ++++++++++++++++++ src/locales/en.ftl | 25 +++++++++++++++++++ 3 files changed, 76 insertions(+), 28 deletions(-) diff --git a/src/HashtagChooser.js b/src/HashtagChooser.js index 2671422..82ac353 100644 --- a/src/HashtagChooser.js +++ b/src/HashtagChooser.js @@ -7,42 +7,39 @@ function HashtagChooser({ onChange, getString }) { const choosenFrameSRC = !!choosenFrame ? choosenFrame.src : null + let hashtags = getString('hashtags') + useEffect(() => { 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( [ '', - '#VoteVolt', - '#JoinTheChange', - '#RejoinEU', - '#DeineWahl', - '#JetztBistDuDran', - '#VoltEuropa', - '#VoltRLP', - '#Volt21', - '#Volt', - '#paneuropäisch', - '#pragmatisch', - '#progressiv', - '#Europa', - - '#democracy', - '#EUReform', - '#European', - '#EuropeCares', - '#FutureMadeInEurope', - '#ValuesOverPower', - '#ZukunftMadeInEurope', - - '#IkStemVolt', - 'stemvolt.nl', - - '#VoltForLGBTIAQ', + '---', + ...hashtags ] .map(async frame_filename => { + let src = frame_filename + if (frame_filename !== '' && !frame_filename.startsWith('---')) { + src = (await import(`./hashtags/${frame_filename}.png`)).default + } return { name: frame_filename, - src: frame_filename === '' ? '' : (await import(`./hashtags/${frame_filename}.png`)).default, + src } }) ) @@ -52,7 +49,7 @@ function HashtagChooser({ onChange, getString }) { }) } loadFrames() - }, []) + }, [hashtags]) const handleImageChoosing = useCallback(frame => { setChoosenFrame(frame) @@ -68,6 +65,9 @@ function HashtagChooser({ onChange, getString }) { frames.map(frame => { const frame_src_path = frame.src const isChoosen = choosenFrameSRC === frame_src_path + if (frame_src_path.startsWith('---')) { + return
+ } return