logo

pleroma-fe

My custom branche(s) on git.pleroma.social/pleroma/pleroma-fe git clone https://anongit.hacktivis.me/git/pleroma-fe.git/
commit: d6600bfa5a90e5ff6edb332f1df24a7429bb5994
parent 82504a1fcfdbf0fc292635103c0bb31fd6a6de18
Author: Henry Jameson <me@hjkos.com>
Date:   Mon, 28 Oct 2024 02:17:07 +0200

do the thing i wanted to do

Diffstat:

Msrc/components/settings_modal/tabs/style_tab/style_tab.js16++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/src/components/settings_modal/tabs/style_tab/style_tab.js b/src/components/settings_modal/tabs/style_tab/style_tab.js @@ -662,7 +662,10 @@ export default { const previewRules = computed(() => { return overallPreviewRules.value.filter(r => { - const rule = r.parent ? r.parent : r + const componentMatch = r.component === selectedComponentName.value + const parentComponentMatch = r.parent === selectedComponentName.value + if (!componentMatch && !parentComponentMatch) return false + const rule = parentComponentMatch ? r.parent : r if (rule.component !== selectedComponentName.value) return false if (rule.variant !== selectedVariant.value) return false return r.state.filter(x => x !== 'normal').every(x => selectedState.has(x)) && @@ -695,9 +698,14 @@ export default { }) const dynamicVars = computed(() => { - console.log('ERR', toValue(previewRules.value)) - // NEED TO FIND SHORTEST - return previewRules.value.find(r => r.parent == null).dynamicVars + console.log('ERR', selectedComponentName.value) + const sorted = [...previewRules.value].sort((a, b) => { + const aSelectorLength = a.selector.split(/ /g).length + const bSelectorLength = b.selector.split(/ /g).length + return aSelectorLength - bSelectorLength + }) + + return sorted[0].dynamicVars }) const previewColors = computed(() => {