@@ -92,15 +92,21 @@ const favicon = computed(() => {
92
92
const normalizedRadius = radius - stroke * 2
93
93
const circumference = normalizedRadius * 2 * Math .PI
94
94
95
- const value = (results .value ? Math .floor ((results .value .performance + results .value .accessibility + results .value .bestPractices + results .value .seo ) / 4 ) : 97 )
96
- const color = value >= 90 ? ' #23c55e' : value >= 50 ? ' #fbbf24' : ' #ef4444'
95
+ const value = status .value === ' pending' || (domain .value && ! results .value )
96
+ ? undefined
97
+ : (results .value ? Math .floor ((results .value .performance + results .value .accessibility + results .value .bestPractices + results .value .seo ) / 4 ) : 100 )
98
+ const color = ! value ? ' #6b7280' : value >= 90 ? ' #23c55e' : value >= 50 ? ' #fbbf24' : ' #ef4444'
97
99
const svg = ` <svg xmlns="http://www.w3.org/2000/svg" height="${radius * 2 }" width="${radius * 2 }">
100
+ <style>@keyframes spin {
101
+ from {transform: rotate(0deg)}
102
+ to {transform: rotate(360deg)}
103
+ }</style>
98
104
<circle
99
105
stroke="${color }"
100
106
fill="transparent"
101
107
stroke-linecap="round"
102
108
stroke-dasharray="${circumference + ' ' + circumference }"
103
- style="transform-origin:center;stroke-dashoffset: ${circumference - (Math .floor (value / 4 ) * 4 ) / 100 * circumference };transform: rotate(270deg)"
109
+ style="transform-origin:center;stroke-dashoffset:${circumference - (Math .floor (( value || 85 ) / 4 ) * 4 ) / 100 * circumference };transform:rotate(270deg)${ ! value ? ' ;animation:spin 1s linear infinite ' : ' ' } "
104
110
stroke-width="${stroke }"
105
111
r="${normalizedRadius }"
106
112
cx="${radius }"
@@ -119,14 +125,17 @@ const favicon = computed(() => {
119
125
120
126
useHead ({
121
127
link: [
122
- {
128
+ () => ({
129
+ key: ' favicon' ,
123
130
rel: ' icon' ,
124
131
type: ' image/svg' ,
125
- href : () => favicon .value
126
- }
132
+ href: favicon .value
133
+ })
127
134
]
128
135
})
129
136
137
+
138
+
130
139
useServerHead ({
131
140
htmlAttrs: {
132
141
lang: ' en' ,
@@ -167,31 +176,17 @@ useServerSeoMeta({
167
176
ogUrl: joinURL (` https://page-speed.dev ` , domain .value )
168
177
})
169
178
179
+ useSeoMeta ({
180
+ title : () => domain .value ? ` page-speed.dev - ${domain .value } ` : ' page-speed.dev' ,
181
+ })
182
+
170
183
if (! domain .value ) {
171
184
defineOgImageComponent (' Home' )
172
185
useServerSeoMeta ({
173
- title: ' page-speed.dev' ,
174
186
description: ' See and share PageSpeed Insights results simply and easily.' ,
175
187
})
176
- useHead ({
177
- link: [
178
- {
179
- rel: ' icon' ,
180
- type: ' image/png' ,
181
- sizes: ' 32x32' ,
182
- href: ' /favicon-32x32.png'
183
- },
184
- {
185
- rel: ' icon' ,
186
- type: ' image/png' ,
187
- sizes: ' 16x16' ,
188
- href: ' /favicon-16x16.png'
189
- },
190
- ]
191
- })
192
188
} else if (results .value ) {
193
189
useServerSeoMeta ({
194
- title: ' page-speed.dev - ' + domain .value ,
195
190
description:
196
191
` Performance: ${results .value ?.performance } | ` +
197
192
` Accessibility: ${results .value ?.accessibility } | ` +
0 commit comments