Skip to content

Commit

Permalink
Add/Update sharing on social services
Browse files Browse the repository at this point in the history
  • Loading branch information
m-mohr committed Jan 2, 2025
1 parent 0354ba0 commit e76574e
Show file tree
Hide file tree
Showing 5 changed files with 120 additions and 12 deletions.
8 changes: 6 additions & 2 deletions config.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,18 @@ export default {
supportedBatchJobSharingServices: [
'ShareEditor',
'CopyUrl',
'TwitterShare'
'BlueskyShare',
'MastodonSocialShare',
'XShare'
],

// List of supported web service sharing services
supportedWebServiceSharingServices: [
'ShareEditor',
'CopyUrl',
'TwitterShare'
'BlueskyShare',
'MastodonSocialShare',
'XShare'
],

// List of supported wizards
Expand Down
4 changes: 2 additions & 2 deletions public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="preload" as="font" type="font/woff2" crossorigin href="https://use.fontawesome.com/releases/v5.13.0/webfonts/fa-solid-900.woff2"/>
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.13.0/css/all.css" type="text/css" media="all" />
<link rel="preload" as="font" type="font/woff2" crossorigin href="https://use.fontawesome.com/releases/v6.7.0/webfonts/fa-solid-900.woff2"/>
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v6.7.0/css/all.css" type="text/css" media="all" />
<link rel="icon" type="image/png" href="logo.png">
</head>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<template>
<ShareInterface id="share-twitter" :icon="['fab', 'fa-twitter']" title="Twitter" description="Share your STAC metadata as a tweet">
<ShareInterface id="share-bluesky" :icon="['fab', 'fa-bluesky']" title="Bluesky" description="Share your STAC metadata as a Bluesky post">
<template #customize>
<textarea v-model="text"></textarea><br />
<button @click="tweet">Open Twitter</button>
<button @click="action">Open Bluesky</button>
</template>
</ShareInterface>
</template>
Expand All @@ -12,7 +12,7 @@ import ShareMixin from './ShareMixin';
import ShareInterface from './ShareInterface.vue';
export default {
name: 'TwitterShare',
name: 'BlueskyShare',
components: {
ShareInterface
},
Expand All @@ -28,19 +28,19 @@ export default {
ShareMixin
],
methods: {
tweet() {
let text = encodeURIComponent(this.text);
let url = `https://twitter.com/intent/tweet?text=${text}`;
action() {
let text = encodeURIComponent(this.text);
let url = `https://bsky.app/intent/compose?text=${text}`;
window.open(url, '_blank').focus();
}
}
}
</script>

<style lang="scss">
#share-twitter {
#share-bluesky {
&.shareable:not(.expanded) > .entry {
color: #1DA1F2;
color: #1185fe;
}
textarea {
width: 100%;
Expand Down
52 changes: 52 additions & 0 deletions src/components/share/MastodonSocialShare.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
<template>
<ShareInterface id="share-mastodon" :icon="['fab', 'fa-mastodon']" title="Mastodon.social" description="Share your STAC metadata as a toot on Mastodon.social">
<template #customize>
<textarea v-model="text"></textarea><br />
<button @click="action">Open Mastodon.social</button>
</template>
</ShareInterface>
</template>

<script>
import ShareMixin from './ShareMixin';
import ShareInterface from './ShareInterface.vue';
export default {
name: 'MastodonSocialShare',
components: {
ShareInterface
},
data() {
return {
text: ""
};
},
created() {
this.text = `"${this.title}" is available at ${this.url}`;
},
mixins: [
ShareMixin
],
methods: {
action() {
let text = encodeURIComponent(this.text);
let url = `https://mastodon.social/share?text=${text}`;
window.open(url, '_blank').focus();
}
}
}
</script>

<style lang="scss">
#share-mastodon {
&.shareable:not(.expanded) > .entry {
color: #6364FF;
}
textarea {
width: 100%;
height: 5em;
overflow: auto;
box-sizing: border-box;
}
}
</style>
52 changes: 52 additions & 0 deletions src/components/share/XShare.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
<template>
<ShareInterface id="share-x" :icon="['fab', 'fa-x']" title="X (Twitter)" description="Share your STAC metadata as a tweet">
<template #customize>
<textarea v-model="text"></textarea><br />
<button @click="action">Open X</button>
</template>
</ShareInterface>
</template>

<script>
import ShareMixin from './ShareMixin';
import ShareInterface from './ShareInterface.vue';
export default {
name: 'XShare',
components: {
ShareInterface
},
data() {
return {
text: ""
};
},
created() {
this.text = `"${this.title}" is available at ${this.url}`;
},
mixins: [
ShareMixin
],
methods: {
action() {
let text = encodeURIComponent(this.text);
let url = `https://x.com/intent/tweet?text=${text}`;
window.open(url, '_blank').focus();
}
}
}
</script>

<style lang="scss">
#share-x {
&.shareable:not(.expanded) > .entry {
color: #000000;
}
textarea {
width: 100%;
height: 5em;
overflow: auto;
box-sizing: border-box;
}
}
</style>

0 comments on commit e76574e

Please sign in to comment.