|
|
@@ -18,7 +18,7 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
|
|
|
- <span class="icon" v-html="unicodeIcon"></span>
|
|
|
+ <ActionIconGlyph class="icon" :glyph="actionGlyph" />
|
|
|
<span class="title" aria-live="polite">{{ displayTitle }}
|
|
|
</span>
|
|
|
<span v-if="rateLimitMessage" class="rate-limit-message">{{ rateLimitMessage }}</span>
|
|
|
@@ -33,7 +33,9 @@ import { useRouter } from 'vue-router'
|
|
|
import { HugeiconsIcon } from '@hugeicons/vue'
|
|
|
import { WorkoutRunIcon, TypeCursorIcon, ComputerTerminal01Icon, WorkHistoryIcon } from '@hugeicons/core-free-icons'
|
|
|
|
|
|
-import { ref, watch, onMounted, onUnmounted, inject, computed } from 'vue'
|
|
|
+import ActionIconGlyph from './components/ActionIconGlyph.vue'
|
|
|
+
|
|
|
+import { ref, watch, onMounted, onUnmounted, computed } from 'vue'
|
|
|
|
|
|
const router = useRouter()
|
|
|
const navigateOnStart = ref('')
|
|
|
@@ -56,7 +58,6 @@ const canExec = ref(true)
|
|
|
const popupOnStart = ref('')
|
|
|
|
|
|
// Display properties
|
|
|
-const unicodeIcon = ref('💩')
|
|
|
const displayTitle = ref('')
|
|
|
|
|
|
// State
|
|
|
@@ -77,6 +78,9 @@ const showNavigateOnStartIcons = computed(() => {
|
|
|
return window.initResponse?.showNavigateOnStartIcons ?? true
|
|
|
})
|
|
|
|
|
|
+const actionGlyph = computed(() => props.actionData?.icon ?? '')
|
|
|
+const glyph = ref('')
|
|
|
+
|
|
|
// Combined classes including custom cssClass
|
|
|
const combinedClasses = computed(() => {
|
|
|
const classes = [...buttonClasses.value]
|
|
|
@@ -89,16 +93,6 @@ const combinedClasses = computed(() => {
|
|
|
// Timestamps
|
|
|
const updateIterationTimestamp = ref(0)
|
|
|
|
|
|
-function getUnicodeIcon(icon) {
|
|
|
- if (icon === '') {
|
|
|
- console.log('icon not found ', icon)
|
|
|
-
|
|
|
- return '💩'
|
|
|
- } else {
|
|
|
- return unescape(icon)
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
function constructFromJson(json) {
|
|
|
updateIterationTimestamp.value = 0
|
|
|
|
|
|
@@ -119,8 +113,7 @@ function constructFromJson(json) {
|
|
|
|
|
|
isDisabled.value = !json.canExec
|
|
|
displayTitle.value = title.value
|
|
|
- unicodeIcon.value = getUnicodeIcon(json.icon)
|
|
|
-
|
|
|
+ glyph.value = json.icon ?? ''
|
|
|
// Initialize rate limit from action data (parse datetime string)
|
|
|
if (json.datetimeRateLimitExpires) {
|
|
|
const date = new Date(json.datetimeRateLimitExpires.replace(' ', 'T'))
|
|
|
@@ -139,8 +132,6 @@ function updateFromJson(json) {
|
|
|
// Fields that should not be updated
|
|
|
// title - as the callback URL relies on it
|
|
|
|
|
|
- unicodeIcon.value = getUnicodeIcon(json.icon)
|
|
|
-
|
|
|
// Update rate limiting if changed (parse datetime string)
|
|
|
if (json.datetimeRateLimitExpires) {
|
|
|
const date = new Date(json.datetimeRateLimitExpires.replace(' ', 'T'))
|
|
|
@@ -334,10 +325,17 @@ watch(
|
|
|
() => props.actionData,
|
|
|
(newData) => {
|
|
|
updateFromJson(newData)
|
|
|
+ if (newData?.icon !== undefined) {
|
|
|
+ glyph.value = newData.icon ?? ''
|
|
|
+ }
|
|
|
},
|
|
|
{ deep: true }
|
|
|
)
|
|
|
|
|
|
+defineExpose({
|
|
|
+ glyph
|
|
|
+})
|
|
|
+
|
|
|
</script>
|
|
|
|
|
|
<style>
|