Skip to content
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
19 changes: 13 additions & 6 deletions src/components/Announcements/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ import {
} from '@fortawesome/free-solid-svg-icons';
import { faFacebook, faLinkedin, faMedium } from '@fortawesome/free-brands-svg-icons';
import ReactTooltip from 'react-tooltip';
import EmailPanel from './platforms/email';

import EmailPanel from './platforms/email'; // ← new
import SlashdotAutoPoster from './platforms/slashdot';

function Announcements({ title, email: initialEmail }) {
const [activeTab, setActiveTab] = useState('email');
Expand Down Expand Up @@ -169,11 +171,16 @@ function Announcements({ title, email: initialEmail }) {
'livejournal',
'slashdot',
'blogger',
].map(platform => (
<TabPane tabId={platform} key={platform}>
<SocialMediaComposer platform={platform} darkMode={darkMode} />
</TabPane>
))}
'truthsocial',
].map(platform => {
const PlatformComposer =
platform === 'slashdot' ? SlashdotAutoPoster : SocialMediaComposer;
return (
<TabPane tabId={platform} key={platform}>
<PlatformComposer platform={platform} darkMode={darkMode} />
</TabPane>
);
})}
</TabContent>
</div>
</div>
Expand Down
59 changes: 59 additions & 0 deletions src/components/Announcements/platforms/slashdot/Helper.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
import React, { useEffect, useState } from 'react';
import axios from 'axios';
import { useParams } from 'react-router-dom';

export default function SlashdotHelper() {
const { id } = useParams();
const [draft, setDraft] = useState(null);

useEffect(() => {
(async () => {
const { data } = await axios.get(`/api/slashdot/drafts/${id}`);
setDraft(data);
})();
}, [id]);

const copy = t => navigator.clipboard.writeText(t || '');

if (!draft) return <div style={{ padding: 24 }}>Loading…</div>;

return (
<div style={{ maxWidth: 760, margin: '24px auto', padding: 12 }}>
<h2>Slashdot Submit Helper</h2>
<ol>
<li>
Open{' '}
<a href="https://slashdot.org/submit" target="_blank" rel="noreferrer">
slashdot.org/submit
</a>{' '}
and ensure you’re logged in.
</li>
<li>Copy each field below and paste into the form; then Preview/Submit.</li>
</ol>
<Field title="Headline" value={draft.headline} copy={copy} />
<Field title="Source URL" value={draft.url} copy={copy} />
<Field title="Dept" value={draft.dept} copy={copy} />
<Field title="Tags" value={draft.tags} copy={copy} />
<Field title="Intro / Summary" value={draft.intro} copy={copy} />
</div>
);
}

function Field({ title, value, copy }) {

Check warning on line 42 in src/components/Announcements/platforms/slashdot/Helper.jsx

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

'title' is missing in props validation

See more on https://sonarcloud.io/project/issues?id=OneCommunityGlobal_HighestGoodNetworkApp&issues=AZ09xoDycIFQUNnUFVCU&open=AZ09xoDycIFQUNnUFVCU&pullRequest=4627

Check warning on line 42 in src/components/Announcements/platforms/slashdot/Helper.jsx

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

'value' is missing in props validation

See more on https://sonarcloud.io/project/issues?id=OneCommunityGlobal_HighestGoodNetworkApp&issues=AZ09xoDycIFQUNnUFVCV&open=AZ09xoDycIFQUNnUFVCV&pullRequest=4627

Check warning on line 42 in src/components/Announcements/platforms/slashdot/Helper.jsx

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

'copy' is missing in props validation

See more on https://sonarcloud.io/project/issues?id=OneCommunityGlobal_HighestGoodNetworkApp&issues=AZ09xoDycIFQUNnUFVCW&open=AZ09xoDycIFQUNnUFVCW&pullRequest=4627
return (
<div style={{ margin: '12px 0' }}>
<h4 style={{ margin: '0 0 6px' }}>{title}</h4>
<pre
style={{
whiteSpace: 'pre-wrap',
background: '#fafafa',
padding: 8,
border: '1px solid #eee',
}}
>
{value || '—'}
</pre>
<button onClick={() => copy(value)}>Copy</button>
</div>
);
}
Loading
Loading