Add Ko-fi integration: footer link, floating widget, and admin field; v1.1.46
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
1 parent
0d830d6e79
commit
d2829e610e
4 files changed
+31
-1
No files matched your search
+1
-1
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "siteforge",
|
||||
"private": true,
|
||||
"version": "1.1.45",
|
||||
"version": "1.1.46",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
|
||||
@@ -936,6 +936,7 @@ const FIELDS: Array<{ key: StringField; label: string; multiline?: boolean; sect
|
||||
{ key: 'platformAmazonUrl', label: 'Platform — Amazon Music URL', section: 'global' },
|
||||
{ key: 'platformFacebookUrl', label: 'Platform — Facebook URL', section: 'global' },
|
||||
{ key: 'platformCreatorUrl', label: 'Platform — Creator Profile URL', section: 'global' },
|
||||
{ key: 'platformKofiUrl', label: 'Platform — Ko-fi URL', section: 'global' },
|
||||
{ key: 'welcomeEmailSubject', label: 'Welcome Email — Subject', section: 'global' },
|
||||
{ key: 'welcomeEmailGreetingPrefix', label: 'Welcome Email — Greeting Prefix', section: 'global' },
|
||||
{ key: 'welcomeEmailIntro', label: 'Welcome Email — Intro Paragraph', multiline: true, section: 'global' },
|
||||
|
||||
+27
@@ -452,6 +452,7 @@ function SiteFooter({ content }: { content: SiteContent }) {
|
||||
const amazonUrl = content.platformAmazonUrl || '/amazon'
|
||||
const creatorUrl = content.platformCreatorUrl || 'https://creators.spotify.com/pod/profile/nmemmert/'
|
||||
const facebookUrl = content.platformFacebookUrl || 'https://facebook.com/versebyversewithnate'
|
||||
const kofiUrl = content.platformKofiUrl
|
||||
const extraFooterLinks = (content.customLinks ?? []).filter(
|
||||
l => l.placement === 'footer' || l.placement === 'platforms' || l.placement === 'otherSites',
|
||||
)
|
||||
@@ -479,6 +480,12 @@ function SiteFooter({ content }: { content: SiteContent }) {
|
||||
<a href={creatorUrl} target="_blank" rel="noreferrer">Creator Profile</a>
|
||||
<span aria-hidden="true">·</span>
|
||||
<a href={facebookUrl} target="_blank" rel="noreferrer">Facebook</a>
|
||||
{kofiUrl && (
|
||||
<>
|
||||
<span aria-hidden="true">·</span>
|
||||
<a href={kofiUrl} target="_blank" rel="noreferrer">Support on Ko-fi</a>
|
||||
</>
|
||||
)}
|
||||
{extraFooterLinks.length > 0 && (
|
||||
<>
|
||||
<span aria-hidden="true">·</span>
|
||||
@@ -2548,6 +2555,26 @@ export default function App() {
|
||||
.catch(() => {})
|
||||
}, [])
|
||||
|
||||
useEffect(() => {
|
||||
const kofiUrl = content.platformKofiUrl
|
||||
if (!kofiUrl) return
|
||||
const username = kofiUrl.replace(/\/$/, '').split('/').pop()
|
||||
if (!username) return
|
||||
if (document.getElementById('kofi-overlay-script')) return
|
||||
const script = document.createElement('script')
|
||||
script.id = 'kofi-overlay-script'
|
||||
script.src = 'https://storage.ko-fi.com/cdn/scripts/overlay-widget.umd.min.js'
|
||||
script.onload = () => {
|
||||
;(window as any).kofiWidgetOverlay?.draw(username, {
|
||||
type: 'floating-chat',
|
||||
'floating-chat.donateButton.text': 'Support the Show',
|
||||
'floating-chat.donateButton.background-color': '#29abe0',
|
||||
'floating-chat.donateButton.text-color': '#fff',
|
||||
})
|
||||
}
|
||||
document.body.appendChild(script)
|
||||
}, [content.platformKofiUrl])
|
||||
|
||||
useEffect(() => {
|
||||
if (location.pathname !== '/' || !location.hash) return
|
||||
|
||||
|
||||
@@ -199,6 +199,7 @@ export interface SiteContent {
|
||||
platformAmazonUrl: string
|
||||
platformFacebookUrl: string
|
||||
platformCreatorUrl: string
|
||||
platformKofiUrl?: string
|
||||
// ── Welcome Email ──
|
||||
welcomeEmailSubject: string
|
||||
welcomeEmailGreetingPrefix: string
|
||||
@@ -416,6 +417,7 @@ export const DEFAULTS: SiteContent = {
|
||||
platformAmazonUrl: '/amazon',
|
||||
platformFacebookUrl: 'https://facebook.com/versebyversewithnate',
|
||||
platformCreatorUrl: 'https://creators.spotify.com/pod/profile/nmemmert/',
|
||||
platformKofiUrl: 'https://ko-fi.com/versebyversewithnate',
|
||||
welcomeEmailSubject: 'Welcome to Verse by Verse with Nate',
|
||||
welcomeEmailGreetingPrefix: 'Glad you\'re here',
|
||||
welcomeEmailIntro: 'Thanks for subscribing to Verse by Verse with Nate - a Bible teaching podcast where we slow down, dig into the text, and pull out the nuggets God has for us word by word.',
|
||||
|
||||
Reference in new issue
Block a user