Skip to content

Commit 15330b8

Browse files
authored
chore: remove spotlight animation (hoppscotch#5171)
1 parent a1079ee commit 15330b8

File tree

2 files changed

+14
-125
lines changed

2 files changed

+14
-125
lines changed

packages/hoppscotch-common/locales/en.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@
150150
"options": "Options",
151151
"proxy_privacy_policy": "Proxy privacy policy",
152152
"reload": "Reload",
153-
"search": "Search",
153+
"search": "Search and commands",
154154
"share": "Share",
155155
"shortcuts": "Shortcuts",
156156
"social_description": "Follow us on social media to stay updated with the latest news, updates and releases.",
Lines changed: 13 additions & 124 deletions
Original file line numberDiff line numberDiff line change
@@ -1,135 +1,24 @@
11
<template>
2-
<div
3-
class="border-animation relative p-[1px] rounded flex-1 self-stretch overflow-hidden flex items-center justify-center"
4-
:class="{
5-
'before:top-1/2 before:left-1/2 before:-translate-x-1/2 before:-translate-y-1/2 before:aspect-square before:w-full before:absolute before:bg-':
6-
!HAS_OPENED_SPOTLIGHT,
7-
}"
8-
aria-hidden="true"
2+
<button
3+
class="relative flex flex-1 cursor-text items-center justify-between self-stretch rounded bg-primaryDark px-2 text-secondaryLight transition hover:border-dividerDark hover:bg-primaryLight hover:text-secondary focus-visible:border-dividerDark focus-visible:bg-primaryLight focus-visible:text-secondary overflow-hidden"
4+
@click="invokeAction('modals.search.toggle', undefined, 'mouseclick')"
95
>
10-
<button
11-
class="relative flex flex-1 cursor-text items-center justify-between self-stretch rounded bg-primaryDark px-2 text-secondaryLight transition hover:border-dividerDark hover:bg-primaryLight hover:text-secondary focus-visible:border-dividerDark focus-visible:bg-primaryLight focus-visible:text-secondary overflow-hidden"
12-
@click="
13-
() => {
14-
invokeAction('modals.search.toggle', undefined, 'mouseclick')
15-
!HAS_OPENED_SPOTLIGHT && toggleSetting('HAS_OPENED_SPOTLIGHT')
16-
}
17-
"
18-
>
19-
<span class="inline-flex flex-1 items-center">
20-
<icon-lucide-search class="svg-icons mr-2" />
21-
<span v-if="!HAS_OPENED_SPOTLIGHT" class="flex flex-1">
22-
{{ t("spotlight.phrases.try") }}
23-
<TransitionGroup tag="div" name="list" class="ml-1 relative">
24-
<span
25-
v-for="(phrase, index) in phraseToShow"
26-
:key="phrase.text"
27-
:data-index="index"
28-
class="truncate"
29-
>
30-
"{{ t(phrase.text) }}"
31-
</span>
32-
</TransitionGroup>
33-
</span>
34-
<template v-else>
35-
{{ t("app.search") }}
36-
</template>
37-
</span>
38-
<span class="flex space-x-1">
39-
<kbd class="shortcut-key">{{ getPlatformSpecialKey() }}</kbd>
40-
<kbd class="shortcut-key">K</kbd>
41-
</span>
42-
</button>
43-
</div>
6+
<span class="inline-flex flex-1 items-center">
7+
<icon-lucide-search class="svg-icons mr-2" />
8+
9+
{{ t("app.search") }}
10+
</span>
11+
<span class="flex space-x-1">
12+
<kbd class="shortcut-key">{{ getPlatformSpecialKey() }}</kbd>
13+
<kbd class="shortcut-key">K</kbd>
14+
</span>
15+
</button>
4416
</template>
4517

4618
<script lang="ts" setup>
47-
import { watch, computed, ref } from "vue"
4819
import { useI18n } from "~/composables/i18n"
49-
import { useSetting } from "~/composables/settings"
5020
import { invokeAction } from "~/helpers/actions"
5121
import { getPlatformSpecialKey } from "~/helpers/platformutils"
52-
import { toggleSetting } from "~/newstore/settings"
5322
5423
const t = useI18n()
55-
56-
const HAS_OPENED_SPOTLIGHT = useSetting("HAS_OPENED_SPOTLIGHT")
57-
58-
const phrases = ref([
59-
{ text: "spotlight.phrases.import_collections", show: true },
60-
{ text: "spotlight.phrases.create_environment", show: false },
61-
{ text: "spotlight.phrases.create_workspace", show: false },
62-
{ text: "spotlight.phrases.share_request", show: false },
63-
])
64-
65-
let intervalId: ReturnType<typeof setTimeout> | null = null
66-
67-
//cycle through the phrases
68-
const showNextPhrase = () => {
69-
let i = 0
70-
intervalId = setInterval(() => {
71-
phrases.value[i].show = false
72-
i++
73-
if (i >= phrases.value.length) {
74-
i = 0
75-
}
76-
phrases.value[i].show = true
77-
}, 3000)
78-
}
79-
80-
const stopPhraseInterval = () => {
81-
if (intervalId) clearInterval(intervalId)
82-
}
83-
84-
const phraseToShow = computed(() => {
85-
return phrases.value.filter((phrase) => phrase.show)
86-
})
87-
88-
watch(
89-
HAS_OPENED_SPOTLIGHT,
90-
() => {
91-
!HAS_OPENED_SPOTLIGHT.value ? showNextPhrase() : stopPhraseInterval()
92-
},
93-
{
94-
immediate: true,
95-
}
96-
)
9724
</script>
98-
99-
<style>
100-
/* Transition Classes */
101-
.list-enter-active {
102-
transition: all 1s ease;
103-
}
104-
.list-leave-active {
105-
transition: all 0.4s ease;
106-
}
107-
.list-enter-from,
108-
.list-leave-to {
109-
opacity: 0;
110-
transform: translateY(-30px);
111-
}
112-
.list-leave-active {
113-
position: absolute;
114-
}
115-
116-
/* Conic gradient */
117-
.border-animation::before {
118-
background: conic-gradient(
119-
transparent 270deg,
120-
var(--accent-color),
121-
transparent
122-
);
123-
animation: rotate 4s linear infinite;
124-
}
125-
126-
@keyframes rotate {
127-
from {
128-
transform: translate(-50%, -50%) scale(1.4) rotate(0turn);
129-
}
130-
131-
to {
132-
transform: translate(-50%, -50%) scale(1.4) rotate(1turn);
133-
}
134-
}
135-
</style>

0 commit comments

Comments
 (0)