Skip to content

Commit eef630d

Browse files
committed
Add link to subscribe to substack
1 parent 98afe9c commit eef630d

4 files changed

Lines changed: 69 additions & 2 deletions

File tree

web/components/BlogInfo.vue

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,18 +27,41 @@
2727
<v-icon left>{{ mdiBookOpenVariant }}</v-icon>
2828
Documentation
2929
</v-btn>
30+
<p class="body-2 mt-6 mb-4">
31+
Subscribe to my newsletter where I share the new features and updates on
32+
httpSMS.
33+
</p>
34+
<v-progress-circular
35+
v-if="!substackLoaded"
36+
indeterminate
37+
size="40"
38+
width="2"
39+
color="primary"
40+
></v-progress-circular>
41+
<div id="custom-substack-embed" ref="custom-substack-embed"></div>
3042
</div>
3143
</template>
3244

3345
<script lang="ts">
3446
import { mdiBookOpenVariant } from '@mdi/js'
47+
import Vue from 'vue'
3548
36-
export default {
49+
export default Vue.extend({
3750
name: 'BlogInfo',
3851
data() {
3952
return {
4053
mdiBookOpenVariant,
54+
substackLoaded: false,
4155
}
4256
},
43-
}
57+
mounted() {
58+
setTimeout(() => {
59+
const s = document.createElement('script')
60+
s.type = 'text/javascript'
61+
s.src = 'https://substackapi.com/widget.js'
62+
document.getElementsByTagName('head')[0].appendChild(s)
63+
this.substackLoaded = true
64+
}, 5000)
65+
},
66+
})
4467
</script>

web/pages/index.vue

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -662,6 +662,25 @@ Console.WriteLine(await response.Content.ReadAsStringAsync());
662662
</v-card>
663663
</v-col>
664664
</v-row>
665+
<client-only>
666+
<v-row>
667+
<v-col class="text-center" md="6" offset-md="3">
668+
<p class="text-h4 text--secondary mt-6 mb-4">
669+
Subscribe to my newsletter where I share new features and
670+
updates on httpSMS.
671+
</p>
672+
<v-progress-circular
673+
v-if="!substackLoaded"
674+
indeterminate
675+
size="40"
676+
width="2"
677+
class="mt-8"
678+
color="primary"
679+
></v-progress-circular>
680+
<div id="custom-substack-embed" ref="substackEmbed"></div>
681+
</v-col>
682+
</v-row>
683+
</client-only>
665684
</v-container>
666685
</v-sheet>
667686
</div>
@@ -719,8 +738,18 @@ export default Vue.extend({
719738
mdiLanguageGo,
720739
selectedTab: 'javascript',
721740
yearlyPricing: false,
741+
substackLoaded: false,
722742
}
723743
},
744+
mounted() {
745+
setTimeout(() => {
746+
const s = document.createElement('script')
747+
s.type = 'text/javascript'
748+
s.src = 'https://substackapi.com/widget.js'
749+
document.getElementsByTagName('head')[0].appendChild(s)
750+
this.substackLoaded = true
751+
}, 5000)
752+
},
724753
})
725754
</script>
726755

web/static/integrations.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,11 @@
1313

1414
// LemonSqueezy
1515
window.lemonSqueezyAffiliateConfig = { store: 'httpsms' }
16+
17+
// substack
18+
window.CustomSubstackWidget = {
19+
substackUrl: 'httpsms.substack.com',
20+
placeholder: 'example@gmail.com',
21+
buttonText: 'Subscribe',
22+
theme: 'green',
23+
}

web/store/index.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,13 @@ export const getters = {
195195
getNotification(state: State): Notification {
196196
return state.notification
197197
},
198+
199+
getSubStackLoaded() {
200+
if (!process.client) {
201+
return false
202+
}
203+
return (window as any).CustomSubstackWidget.scriptLoaded
204+
},
198205
}
199206

200207
export const mutations = {

0 commit comments

Comments
 (0)