From f06c7da3e09afbbe757101677b4c8f32d051e471 Mon Sep 17 00:00:00 2001 From: Markus Hatvan Date: Thu, 14 Oct 2021 08:48:08 +0200 Subject: chore: convert class components to functional (#2065) --- .../settings/supportFerdi/SupportFerdiDashboard.js | 234 --------------------- .../supportFerdi/SupportFerdiDashboard.tsx | 232 ++++++++++++++++++++ 2 files changed, 232 insertions(+), 234 deletions(-) delete mode 100644 src/components/settings/supportFerdi/SupportFerdiDashboard.js create mode 100644 src/components/settings/supportFerdi/SupportFerdiDashboard.tsx (limited to 'src/components/settings') diff --git a/src/components/settings/supportFerdi/SupportFerdiDashboard.js b/src/components/settings/supportFerdi/SupportFerdiDashboard.js deleted file mode 100644 index b906df5c8..000000000 --- a/src/components/settings/supportFerdi/SupportFerdiDashboard.js +++ /dev/null @@ -1,234 +0,0 @@ -import { Component } from 'react'; -import { defineMessages, injectIntl } from 'react-intl'; -import { BrowserWindow } from '@electron/remote'; -import InfoBar from '../../ui/InfoBar'; - -const messages = defineMessages({ - headline: { - id: 'settings.supportFerdi.headline', - defaultMessage: 'About Ferdi', - }, - title: { - id: 'settings.supportFerdi.title', - defaultMessage: 'Do you like Ferdi?', - }, - aboutIntro: { - id: 'settings.supportFerdi.aboutIntro', - defaultMessage: - '

Ferdi is an open-source and a community-lead application.

Thanks to the people who make this possbile:

', - }, - textListContributors: { - id: 'settings.supportFerdi.textListContributors', - defaultMessage: 'Full list of contributors', - }, - textListContributorsHere: { - id: 'settings.supportFerdi.textListContributorsHere', - defaultMessage: 'here', - }, - textVolunteers: { - id: 'settings.supportFerdi.textVolunteers', - defaultMessage: - 'The development of Ferdi is done by volunteers. People who use Ferdi like you. They maintain, fix, and improve Ferdi in their spare time.', - }, - textSupportWelcome: { - id: 'settings.supportFerdi.textSupportWelcome', - defaultMessage: - 'Support is always welcome. You can find a list of the help we need', - }, - textSupportWelcomeHere: { - id: 'settings.supportFerdi.textSupportWelcomeHere', - defaultMessage: 'here', - }, - textExpenses: { - id: 'settings.supportFerdi.textExpenses', - defaultMessage: - 'While volunteers do most of the work, we still need to pay for servers and certificates. As a community, we are fully transparent on funds we collect and spend - see our', - }, - textOpenCollective: { - id: 'settings.supportFerdi.textOpenCollective', - defaultMessage: 'Open Collective', - }, - textDonation: { - id: 'settings.supportFerdi.textDonation', - defaultMessage: - 'If you feel like supporting Ferdi development with a donation, you can do so on both,', - }, - textDonationAnd: { - id: 'settings.supportFerdi.textDonationAnd', - defaultMessage: 'and', - }, - textGitHubSponsors: { - id: 'settings.supportFerdi.textGitHubSponsors', - defaultMessage: 'GitHub Sponsors', - }, - openSurvey: { - id: 'settings.supportFerdi.openSurvey', - defaultMessage: 'Open survey', - }, - bannerText: { - id: 'settings.supportFerdi.bannerText', - defaultMessage: 'Do you want to help us improve Ferdi?', - }, -}); - -class SupportFerdiDashboard extends Component { - openSurveyWindow() { - let win = new BrowserWindow({ width: 670, height: 400 }); - win.on('closed', () => { - win = null; - }); - - win.loadURL('https://rp28.typeform.com/to/E3phJT'); - } - - render() { - const { intl } = this.props; - - const aboutIntro = intl.formatMessage(messages.aboutIntro); - - return ( -
-
- - {intl.formatMessage(messages.headline)} - -
-
-

{intl.formatMessage(messages.title)}

-
-

- - GitHub Stars - - - Twitter Follow - - - Open Collective backers - - - Open Collective sponsors - -

- -
-
-

- - GitHub contributors (non-exhaustive) - -

-

- {intl.formatMessage(messages.textListContributors)} - - {' '} - {intl.formatMessage(messages.textListContributorsHere)} - - -
-
-

-

{intl.formatMessage(messages.textVolunteers)}

-

- {intl.formatMessage(messages.textSupportWelcome)} - - {' '} - {intl.formatMessage(messages.textSupportWelcomeHere)} - - -

-

- {intl.formatMessage(messages.textExpenses)} - - {' '} - {intl.formatMessage(messages.textOpenCollective)} - - -

-

- {intl.formatMessage(messages.textDonation)} - - {' '} - {intl.formatMessage(messages.textOpenCollective)} - - {' '} - {intl.formatMessage(messages.textDonationAnd)} - - {' '} - {intl.formatMessage(messages.textGitHubSponsors)} - - -

-
-
- - {intl.formatMessage(messages.bannerText)} - -
- ); - } -} - -export default injectIntl(SupportFerdiDashboard); diff --git a/src/components/settings/supportFerdi/SupportFerdiDashboard.tsx b/src/components/settings/supportFerdi/SupportFerdiDashboard.tsx new file mode 100644 index 000000000..505c49812 --- /dev/null +++ b/src/components/settings/supportFerdi/SupportFerdiDashboard.tsx @@ -0,0 +1,232 @@ +import { defineMessages, useIntl } from 'react-intl'; +import { BrowserWindow } from '@electron/remote'; +import InfoBar from '../../ui/InfoBar'; + +const messages = defineMessages({ + headline: { + id: 'settings.supportFerdi.headline', + defaultMessage: 'About Ferdi', + }, + title: { + id: 'settings.supportFerdi.title', + defaultMessage: 'Do you like Ferdi?', + }, + aboutIntro: { + id: 'settings.supportFerdi.aboutIntro', + defaultMessage: + '

Ferdi is an open-source and a community-lead application.

Thanks to the people who make this possbile:

', + }, + textListContributors: { + id: 'settings.supportFerdi.textListContributors', + defaultMessage: 'Full list of contributors', + }, + textListContributorsHere: { + id: 'settings.supportFerdi.textListContributorsHere', + defaultMessage: 'here', + }, + textVolunteers: { + id: 'settings.supportFerdi.textVolunteers', + defaultMessage: + 'The development of Ferdi is done by volunteers. People who use Ferdi like you. They maintain, fix, and improve Ferdi in their spare time.', + }, + textSupportWelcome: { + id: 'settings.supportFerdi.textSupportWelcome', + defaultMessage: + 'Support is always welcome. You can find a list of the help we need', + }, + textSupportWelcomeHere: { + id: 'settings.supportFerdi.textSupportWelcomeHere', + defaultMessage: 'here', + }, + textExpenses: { + id: 'settings.supportFerdi.textExpenses', + defaultMessage: + 'While volunteers do most of the work, we still need to pay for servers and certificates. As a community, we are fully transparent on funds we collect and spend - see our', + }, + textOpenCollective: { + id: 'settings.supportFerdi.textOpenCollective', + defaultMessage: 'Open Collective', + }, + textDonation: { + id: 'settings.supportFerdi.textDonation', + defaultMessage: + 'If you feel like supporting Ferdi development with a donation, you can do so on both,', + }, + textDonationAnd: { + id: 'settings.supportFerdi.textDonationAnd', + defaultMessage: 'and', + }, + textGitHubSponsors: { + id: 'settings.supportFerdi.textGitHubSponsors', + defaultMessage: 'GitHub Sponsors', + }, + openSurvey: { + id: 'settings.supportFerdi.openSurvey', + defaultMessage: 'Open survey', + }, + bannerText: { + id: 'settings.supportFerdi.bannerText', + defaultMessage: 'Do you want to help us improve Ferdi?', + }, +}); + +const openSurveyWindow = () => { + let win = new BrowserWindow({ width: 670, height: 400 }); + win.on('closed', () => { + // @ts-expect-error Type 'null' is not assignable to type 'BrowserWindow'. + win = null; + }); + + win.loadURL('https://rp28.typeform.com/to/E3phJT'); +}; + +const SupportFerdiDashboard = () => { + const intl = useIntl(); + + const aboutIntro = intl.formatMessage(messages.aboutIntro); + + return ( +
+
+ + {intl.formatMessage(messages.headline)} + +
+
+

{intl.formatMessage(messages.title)}

+
+

+ + GitHub Stars + + + Twitter Follow + + + Open Collective backers + + + Open Collective sponsors + +

+ +
+
+

+ + GitHub contributors (non-exhaustive) + +

+

+ {intl.formatMessage(messages.textListContributors)} + + {' '} + {intl.formatMessage(messages.textListContributorsHere)} + + +
+
+

+

{intl.formatMessage(messages.textVolunteers)}

+

+ {intl.formatMessage(messages.textSupportWelcome)} + + {' '} + {intl.formatMessage(messages.textSupportWelcomeHere)} + + +

+

+ {intl.formatMessage(messages.textExpenses)} + + {' '} + {intl.formatMessage(messages.textOpenCollective)} + + +

+

+ {intl.formatMessage(messages.textDonation)} + + {' '} + {intl.formatMessage(messages.textOpenCollective)} + + {' '} + {intl.formatMessage(messages.textDonationAnd)} + + {' '} + {intl.formatMessage(messages.textGitHubSponsors)} + + +

+
+
+ + {intl.formatMessage(messages.bannerText)} + +
+ ); +}; + +export default SupportFerdiDashboard; -- cgit v1.2.3-70-g09d2