Skip to content

Fix og images #132

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 22 commits into from
May 15, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion components/LeftSidebar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ const mainLinks = reactive([
name: "Ecosystem",
path: "/stats?tab=ecosystem",
queryParam: {tab: "ecosystem"},
show: true,
show: false,
// show: isMainnet(),
},
],
Expand Down
7 changes: 2 additions & 5 deletions components/OgImage/AddressImage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@ const props = defineProps({
const bgStyles = computed(() => {
return {
style: {
position: "absolute",
top: "0",
left: "0",
filter: "grayscale(1)",
opacity: "0.05",
},
Expand All @@ -28,8 +25,8 @@ const bgStyles = computed(() => {
</script>

<template>
<div class="w-full h-full" :style="{ background: '#111111', padding: '100px 120px', fontFamily: 'IBM+Plex+Mono' }">
<img src="/img/bg.png" v-bind="bgStyles" />
<div class="w-full h-full" :style="{ background: '#111111', padding: '100px', fontFamily: 'IBM+Plex+Mono', overflow: 'hidden' }">
<img src="/img/bg.png" width="1200" height="600" class="absolute" v-bind="bgStyles" />

<div :style="{ height: '100%', display: 'flex', flexDirection: 'column', gap: '40px' }">
<div :style="{ display: 'flex', alignItems: 'center' }">
Expand Down
7 changes: 2 additions & 5 deletions components/OgImage/BlockImage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@ const props = defineProps({
const bgStyles = computed(() => {
return {
style: {
position: "absolute",
top: "0",
left: "0",
filter: "grayscale(1)",
opacity: "0.05",
},
Expand All @@ -30,8 +27,8 @@ const messages = computed(() => [...new Set(props.block.message_types)])
</script>

<template>
<div class="w-full h-full" :style="{ background: '#111111', padding: '100px 120px', fontFamily: 'IBM+Plex+Mono' }">
<img src="/img/bg.png" v-bind="bgStyles" />
<div class="w-full h-full" :style="{ background: '#111111', padding: '100px', fontFamily: 'IBM+Plex+Mono', overflow: 'hidden' }">
<img src="/img/bg.png" width="1200" height="600" class="absolute" v-bind="bgStyles" />

<div :style="{ height: '100%', display: 'flex', flexDirection: 'column', gap: '40px' }">
<div :style="{ display: 'flex' }">
Expand Down
7 changes: 2 additions & 5 deletions components/OgImage/NamespaceImage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@ const props = defineProps({
const bgStyles = computed(() => {
return {
style: {
position: "absolute",
top: "0",
left: "0",
filter: "grayscale(1)",
opacity: "0.05",
},
Expand All @@ -25,8 +22,8 @@ const bgStyles = computed(() => {
</script>

<template>
<div class="w-full h-full" :style="{ background: '#111111', padding: '100px 120px', fontFamily: 'IBM+Plex+Mono' }">
<img src="/img/bg.png" v-bind="bgStyles" />
<div class="w-full h-full" :style="{ background: '#111111', padding: '100px', fontFamily: 'IBM+Plex+Mono', overflow: 'hidden' }">
<img src="/img/bg.png" width="1200" height="600" class="absolute" v-bind="bgStyles" />

<div :style="{ height: '100%', display: 'flex', flexDirection: 'column', gap: '40px' }">
<div :style="{ display: 'flex', alignItems: 'center' }">
Expand Down
7 changes: 2 additions & 5 deletions components/OgImage/RollupImage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@ const props = defineProps({
const bgStyles = computed(() => {
return {
style: {
position: "absolute",
top: "0",
left: "0",
filter: "grayscale(1)",
opacity: "0.05",
},
Expand All @@ -28,8 +25,8 @@ const bgStyles = computed(() => {
</script>

<template>
<div class="w-full h-full" :style="{ background: '#111111', padding: '100px 120px', fontFamily: 'IBM+Plex+Mono' }">
<img src="/img/bg.png" v-bind="bgStyles" />
<div class="w-full h-full" :style="{ background: '#111111', padding: '100px', fontFamily: 'IBM+Plex+Mono', overflow: 'hidden' }">
<img src="/img/bg.png" width="1200" height="600" class="absolute" v-bind="bgStyles" />

<div :style="{ height: '100%', display: 'flex', flexDirection: 'column', gap: '80px' }">
<div :style="{ display: 'flex', alignItems: 'center' }">
Expand Down
37 changes: 0 additions & 37 deletions components/OgImage/StatsMetricImage.vue

This file was deleted.

17 changes: 8 additions & 9 deletions components/OgImage/TxImage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@ const props = defineProps({
const bgStyles = computed(() => {
return {
style: {
position: "absolute",
top: "0",
left: "0",
filter: "grayscale(1)",
opacity: "0.05",
},
Expand All @@ -30,12 +27,12 @@ const messages = computed(() => [...new Set(props.tx.message_types)])
</script>

<template>
<div class="w-full h-full" :style="{ background: '#111111', padding: '100px 120px', fontFamily: 'IBM+Plex+Mono' }">
<img src="/img/bg.png" v-bind="bgStyles" />
<div class="w-full h-full" :style="{ background: '#111111', padding: '100px', fontFamily: 'IBM+Plex+Mono', overflow: 'hidden' }">
<img src="/img/bg.png" width="1200" height="600" class="absolute" v-bind="bgStyles" />

<div :style="{ height: '100%', display: 'flex', flexDirection: 'column', gap: '40px' }">
<div :style="{ display: 'flex', alignItems: 'center', gap: '24px' }">
<div :style="{ display: 'flex', alignItems: 'center' }">
<div class="flex flex-row items-center" :style="{ gap: '24px' }">
<div class="flex items-center flex-nowrap">
<span :style="{ fontSize: '70px', color: 'rgba(255,255,255, 0.9)' }"> tx </span>
<span :style="{ fontSize: '70px', color: 'rgba(255,255,255, 0.3)' }">('</span>
<span :style="{ fontSize: '70px', color: '#FF8351' }">
Expand Down Expand Up @@ -76,9 +73,11 @@ const messages = computed(() => [...new Set(props.tx.message_types)])
</span>
</div>

<span :style="{ fontSize: '40px', color: 'rgba(255,255,255, 0.4)' }">{{ DateTime.fromISO(tx.time).toFormat("ff") }}</span>
<span :style="{ fontSize: '40px', marginBottom: '40px', color: 'rgba(255,255,255, 0.4)' }">{{
DateTime.fromISO(tx.time).toFormat("ff")
}}</span>

<div :style="{ display: 'flex', flexDirection: 'column', gap: '24px' }">
<div class="flex flex-col" :style="{ gap: '24px' }">
<div :style="{ display: 'flex', gap: '12px' }">
<span :style="{ fontSize: '40px', color: 'rgba(255,255,255, 0.3)' }">Fee: </span>
<span :style="{ fontSize: '40px', color: 'rgba(255,255,255, 0.6)' }">{{ tia(tx.fee) }} </span>
Expand Down
11 changes: 4 additions & 7 deletions components/OgImage/ValidatorImage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@ const props = defineProps({
const bgStyles = computed(() => {
return {
style: {
position: "absolute",
top: "0",
left: "0",
filter: "grayscale(1)",
opacity: "0.05",
},
Expand All @@ -25,18 +22,18 @@ const bgStyles = computed(() => {
</script>

<template>
<div class="w-full h-full" :style="{ background: '#111111', padding: '100px 80px', fontFamily: 'IBM+Plex+Mono' }">
<img src="/img/bg.png" v-bind="bgStyles" />
<div class="w-full h-full" :style="{ background: '#111111', padding: '100px 50px', fontFamily: 'IBM+Plex+Mono', overflow: 'hidden' }">
<img src="/img/bg.png" width="1200" height="600" class="absolute" v-bind="bgStyles" />

<div :style="{ height: '100%', display: 'flex', flexDirection: 'column', gap: '50px' }">
<div :style="{ display: 'flex', alignItems: 'center' }">
<span :style="{ fontSize: '60px', color: 'rgba(255,255,255, 0.9)' }">validator</span>
<span :style="{ fontSize: '60px', color: 'rgba(255,255,255, 0.3)' }">('</span>
<span :style="{ fontSize: '40px', color: '#FF8351' }"> celestiavaloper•••{{ validator.address.slice(-4) }} </span>
<span :style="{ fontSize: '40px', color: '#FF8351' }"> celestiavaloper•••{{ validator.address.hash.slice(-4) }} </span>
<span :style="{ fontSize: '60px', color: 'rgba(255,255,255, 0.3)' }">')</span>
</div>

<span :style="{ fontSize: '46px', color: 'rgba(255,255,255, 0.9)' }">
<span v-if="validator.moniker" :style="{ fontSize: '46px', color: 'rgba(255,255,255, 0.9)' }">
{{ validator.moniker }}
</span>

Expand Down
13 changes: 9 additions & 4 deletions nuxt.config.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
import { nodePolyfills } from "vite-plugin-node-polyfills"
import wasm from "vite-plugin-wasm"
import topLevelAwait from "vite-plugin-top-level-await"
import { updateSiteConfig } from "nuxt-site-config/kit"

import path from "path"

export default defineNuxtConfig({
modules: ["@pinia/nuxt", "nuxt-og-image", "@nuxtjs/sitemap"],
modules: ["nuxt-site-config", "@pinia/nuxt", "nuxt-og-image", "@nuxtjs/sitemap"],

site: {
url: "https://celenium.io",
hooks: {
"site-config:resolve": () => {
updateSiteConfig({
url: process.env.CF_PAGES_URL ?? "https://celenium.io",
})
},
},

sitemap: {
Expand Down Expand Up @@ -149,4 +154,4 @@ export default defineNuxtConfig({
},

compatibilityDate: "2025-04-02",
})
})
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"@unhead/vue": "^2.0.0-rc.1",
"cross-env": "^7.0.3",
"nuxt": "3.16.2",
"nuxt-og-image": "5.1.1",
"nuxt-og-image": "5.1.3",
"sass": "1.66.1",
"sass-loader": "13.3.2",
"unenv": "^1.9.0",
Expand All @@ -45,6 +45,7 @@
"lean-qr": "^2.3.2",
"long": "^5.2.3",
"luxon": "3.4.3",
"nuxt-site-config": "^3.1.9",
"pinia": "3.0.2",
"protobufjs": "^7.2.6",
"qrcode": "^1.5.3",
Expand Down
11 changes: 3 additions & 8 deletions pages/address/[hash].vue
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,9 @@ if (!rawAddress.value) {
cacheStore.current.address = address.value
}

defineOgImage({
defineOgImageComponent("AddressImage", {
title: "Address",
address: address.value,
component: "AddressImage",
cacheKey: `${address.value?.hash.slice(-4)}-${address.value?.balance.spendable}-${address.value?.first_height}-${
address.value?.last_height
}`,
Expand All @@ -38,7 +37,7 @@ useHead({
link: [
{
rel: "canonical",
href: `https://celenium.io${route.path}`,
href: `${useRequestURL().origin}${useRequestURL().pathname}`,
},
],
meta: [
Expand All @@ -56,11 +55,7 @@ useHead({
},
{
property: "og:url",
content: `https://celenium.io${route.path}`,
},
{
property: "og:image",
content: `https://celenium.io${route.path}__og_image__/og.png`,
content: `${useRequestURL().origin}${useRequestURL().pathname}`,
},
{
name: "twitter:title",
Expand Down
11 changes: 3 additions & 8 deletions pages/block/[height].vue
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,9 @@ if (!rawBlock.value) {
cacheStore.current.block = block.value
}

defineOgImage({
defineOgImageComponent("BlockImage", {
title: "Block",
block: block.value,
component: "BlockImage",
cacheKey: `${block.value?.height}`,
})

Expand All @@ -44,7 +43,7 @@ useHead({
link: [
{
rel: "canonical",
href: `https://celenium.io${route.path}`,
href: `${useRequestURL().origin}${useRequestURL().pathname}`,
},
],
meta: [
Expand All @@ -62,11 +61,7 @@ useHead({
},
{
property: "og:url",
content: `https://celenium.io${route.path}`,
},
{
property: "og:image",
content: `https://celenium.io${route.path}__og_image__/og.png`,
content: `${useRequestURL().origin}${useRequestURL().pathname}`,
},
{
name: "twitter:title",
Expand Down
11 changes: 3 additions & 8 deletions pages/namespace/[id].vue
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,9 @@ if (!rawNamespace.value) {
cacheStore.current.namespace = namespace.value
}

defineOgImage({
defineOgImageComponent("NamespaceImage", {
title: "Namespace",
namespace: namespace.value,
component: "NamespaceImage",
cacheKey: `${namespace.value?.hash}`,
})

Expand All @@ -38,7 +37,7 @@ useHead({
link: [
{
rel: "canonical",
href: `https://celenium.io${route.path}`,
href: `${useRequestURL().origin}${useRequestURL().pathname}`,
},
],
meta: [
Expand All @@ -56,11 +55,7 @@ useHead({
},
{
property: "og:url",
content: `https://celenium.io${route.path}`,
},
{
property: "og:image",
content: `https://celenium.io${route.path}__og_image__/og.png`,
content: `${useRequestURL().origin}${useRequestURL().pathname}`,
},
{
name: "twitter:title",
Expand Down
11 changes: 3 additions & 8 deletions pages/rollup/[slug].vue
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,9 @@ if (!rawRollup.value) {
cacheStore.current.rollup = rollup.value
}

defineOgImage({
defineOgImageComponent("RollupImage", {
title: "Rollup",
rollup: rollup.value,
component: "RollupImage",
cacheKey: `${rollup.value?.name}`,
})

Expand All @@ -38,7 +37,7 @@ useHead({
link: [
{
rel: "canonical",
href: `https://celenium.io${route.path}`,
href: `${useRequestURL().origin}${useRequestURL().pathname}`,
},
],
meta: [
Expand All @@ -56,11 +55,7 @@ useHead({
},
{
property: "og:url",
content: `https://celenium.io${route.path}`,
},
{
property: "og:image",
content: `https://celenium.io${route.path}__og_image__/og.png`,
content: `${useRequestURL().origin}${useRequestURL().pathname}`,
},
{
name: "twitter:title",
Expand Down
Loading