From b2686521cf2ca6bb0b5c5164de72d3d39d5c510e Mon Sep 17 00:00:00 2001
From: Armand Philippot <git@armandphilippot.com>
Date: Sat, 29 Jan 2022 23:17:49 +0100
Subject: refactor(widgets): move sharing websites from config to sharing
 widget

I only use these websites inside the sharing widget so it makes more
sense to gather them. In addition, I can translate the website name if
needed.
---
 src/components/Widgets/Sharing/Sharing.tsx | 91 +++++++++++++++++++++++++++++-
 1 file changed, 88 insertions(+), 3 deletions(-)

(limited to 'src/components/Widgets/Sharing/Sharing.tsx')

diff --git a/src/components/Widgets/Sharing/Sharing.tsx b/src/components/Widgets/Sharing/Sharing.tsx
index 1025717..dd2d2a0 100644
--- a/src/components/Widgets/Sharing/Sharing.tsx
+++ b/src/components/Widgets/Sharing/Sharing.tsx
@@ -1,5 +1,5 @@
 import { ExpandableWidget } from '@components/WidgetParts';
-import sharingMedia from '@config/sharing';
+import { getIntlInstance } from '@utils/helpers/i18n';
 import { useRouter } from 'next/router';
 import { useEffect, useState } from 'react';
 import { useIntl } from 'react-intl';
@@ -95,9 +95,94 @@ const Sharing = ({ excerpt, title }: { excerpt: string; title: string }) => {
     return sharingUrl;
   };
 
-  const getItems = () => {
-    const websites: Website[] = sharingMedia;
+  const websites = [
+    {
+      id: 'diaspora',
+      name: intl.formatMessage({
+        defaultMessage: 'Diaspora',
+        description: 'Sharing: Diaspora',
+      }),
+      parameters: {
+        content: '',
+        image: '',
+        title: 'title',
+        url: 'url',
+      },
+      url: 'https://share.diasporafoundation.org/',
+    },
+    {
+      id: 'facebook',
+      name: intl.formatMessage({
+        defaultMessage: 'Facebook',
+        description: 'Sharing: Facebook',
+      }),
+      parameters: {
+        content: '',
+        image: '',
+        title: '',
+        url: 'u',
+      },
+      url: 'https://www.facebook.com/sharer/sharer.php',
+    },
+    {
+      id: 'linkedin',
+      name: intl.formatMessage({
+        defaultMessage: 'LinkedIn',
+        description: 'Sharing: LinkedIn',
+      }),
+      parameters: {
+        content: '',
+        image: '',
+        title: '',
+        url: 'url',
+      },
+      url: 'https://www.linkedin.com/sharing/share-offsite/',
+    },
+    {
+      id: 'twitter',
+      name: intl.formatMessage({
+        defaultMessage: 'Twitter',
+        description: 'Sharing: Twitter',
+      }),
+      parameters: {
+        content: '',
+        image: '',
+        title: 'text',
+        url: 'url',
+      },
+      url: 'https://twitter.com/intent/tweet',
+    },
+    {
+      id: 'journal-du-hacker',
+      name: intl.formatMessage({
+        defaultMessage: 'Journal du hacker',
+        description: 'Sharing: Journal du hacker',
+      }),
+      parameters: {
+        content: '',
+        image: '',
+        title: 'title',
+        url: 'url',
+      },
+      url: 'https://www.journalduhacker.net/stories/new',
+    },
+    {
+      id: 'email',
+      name: intl.formatMessage({
+        defaultMessage: 'Email',
+        description: 'Sharing: Email',
+      }),
+      parameters: {
+        content: 'body',
+        image: '',
+        title: 'subject',
+        url: '',
+      },
+      url: 'mailto:',
+    },
+  ];
 
+  const getItems = () => {
     return websites.map((website) => {
       const { id, name } = website;
       const sharingUrl = getSharingUrl(website);
-- 
cgit v1.2.3

