Skip to content

Commit 3e895dd

Browse files
author
Riddhi
committed
Changed jquery to vue in applythemes
1 parent 0463a60 commit 3e895dd

File tree

1 file changed

+10
-12
lines changed

1 file changed

+10
-12
lines changed

src/components/DialogBox/Themes/ApplyThemes.vue

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,10 @@
2626
:id="theme"
2727
:key="theme"
2828
class="theme"
29-
:class="
30-
theme == selectedTheme ? 'selected set' : ''
31-
"
29+
:class="{
30+
selected: theme === selectedTheme,
31+
set: theme === selectedThemeRef
32+
}"
3233
>
3334
<div
3435
class="themeSel"
@@ -161,6 +162,7 @@ const customThemes = ref<((keyof typeof customThemesList)[]) | undefined>(undefi
161162
const customThemesList: Themes = reactive({})
162163
const selectedTheme = ref('default-theme')
163164
const iscustomTheme = ref(false)
165+
const selectedThemeRef = ref<string | null>(null)
164166
165167
onMounted(() => {
166168
SimulatorState.dialogBox.theme_dialog = false
@@ -195,36 +197,32 @@ function changeCustomTheme(e: InputEvent) {
195197
196198
function applyTheme() {
197199
if (iscustomTheme.value == false) {
198-
if ($('.selected label').text()) {
200+
if (selectedTheme.value) {
199201
localStorage.removeItem('Custom Theme')
200-
localStorage.setItem('theme', $('.selected label').text())
202+
localStorage.setItem('theme', selectedTheme.value)
201203
}
202204
} else {
203-
// update theme to Custom Theme
204205
localStorage.setItem('theme', 'Custom Theme')
205-
// add Custom theme to custom theme object
206206
localStorage.setItem(
207207
'Custom Theme',
208208
JSON.stringify(themeOptions['Custom Theme'])
209209
)
210210
}
211-
$('.set').removeClass('set')
212-
$('.selected').addClass('set')
211+
selectedThemeRef.value = selectedTheme.value
213212
SimulatorState.dialogBox.theme_dialog = false
214213
setTimeout(() => (iscustomTheme.value = false), 1000)
215214
}
215+
216216
function applyCustomTheme() {
217217
iscustomTheme.value = true
218218
updateThemeForStyle(localStorage.getItem('theme'))
219219
updateBG()
220220
localStorage.setItem('theme', 'Custom Theme')
221-
// add Custom theme to custom theme object
222221
localStorage.setItem(
223222
'Custom Theme',
224223
JSON.stringify(themeOptions['Custom Theme'])
225224
)
226-
$('.set').removeClass('set')
227-
$('.selected').addClass('set')
225+
selectedThemeRef.value = selectedTheme.value
228226
}
229227
230228
function receivedText(e: ProgressEvent<FileReader>) {

0 commit comments

Comments
 (0)