From 5a6dcf0c4dfcfa9d330d8ec782ae388b48ae08c6 Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Thu, 25 Aug 2022 20:32:18 -0500 Subject: [PATCH 1/7] Embeds: render embeds before anything else --- app/soapbox/containers/soapbox.tsx | 34 ++++++++++++++++-------------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/app/soapbox/containers/soapbox.tsx b/app/soapbox/containers/soapbox.tsx index d46c7f0af8..92b6f6f955 100644 --- a/app/soapbox/containers/soapbox.tsx +++ b/app/soapbox/containers/soapbox.tsx @@ -149,12 +149,6 @@ const SoapboxMount = () => { )} - } - /> - - @@ -176,19 +170,27 @@ const SoapboxMount = () => { - <> - {renderBody()} + + } + /> + - - {(Component) => } - + + {renderBody()} - - {Component => } - + + {(Component) => } + - - + + {Component => } + + + + + From 3909c74c00454668f1da6d4484856a1c70d78128 Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Thu, 25 Aug 2022 21:21:03 -0500 Subject: [PATCH 2/7] Add new CopyableInput component, use in EmbedModal --- app/soapbox/components/copyable-input.tsx | 42 +++++++++++++++++++ app/soapbox/components/ui/button/button.tsx | 10 ++--- .../features/ui/components/embed-modal.tsx | 14 ++----- 3 files changed, 50 insertions(+), 16 deletions(-) create mode 100644 app/soapbox/components/copyable-input.tsx diff --git a/app/soapbox/components/copyable-input.tsx b/app/soapbox/components/copyable-input.tsx new file mode 100644 index 0000000000..4a42452bbf --- /dev/null +++ b/app/soapbox/components/copyable-input.tsx @@ -0,0 +1,42 @@ +import React, { useRef } from 'react'; +import { FormattedMessage } from 'react-intl'; + +import { Button, HStack, Input } from './ui'; + +interface ICopyableInput { + /** Text to be copied. */ + value?: string, +} + +/** An input with copy abilities. */ +const CopyableInput: React.FC = ({ value }) => { + const input = useRef(null); + + const selectInput = () => { + input.current?.select(); + }; + + return ( + + + + + + ); +}; + +export default CopyableInput; diff --git a/app/soapbox/components/ui/button/button.tsx b/app/soapbox/components/ui/button/button.tsx index 15826ff2d3..e3ae339fc7 100644 --- a/app/soapbox/components/ui/button/button.tsx +++ b/app/soapbox/components/ui/button/button.tsx @@ -1,3 +1,4 @@ +import classNames from 'classnames'; import * as React from 'react'; import { Link } from 'react-router-dom'; @@ -12,8 +13,8 @@ interface IButton { block?: boolean, /** Elements inside the - - ); -}; From 764b2302d92de8d3356a1fba9bf1311cf17c1698 Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Thu, 25 Aug 2022 21:31:03 -0500 Subject: [PATCH 6/7] Embeds: enable for TruthSocial --- app/soapbox/utils/features.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/soapbox/utils/features.ts b/app/soapbox/utils/features.ts index 2043e35456..c9eac36880 100644 --- a/app/soapbox/utils/features.ts +++ b/app/soapbox/utils/features.ts @@ -242,7 +242,10 @@ const getInstanceFeatures = (instance: Instance) => { * Ability to embed posts on external sites. * @see GET /api/oembed */ - embeds: v.software === MASTODON, + embeds: any([ + v.software === MASTODON, + v.software === TRUTHSOCIAL, + ]), /** * Ability to add emoji reactions to a status. From 954e02067e3adb8b3b7d0c83430d8af0960ffaf3 Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Thu, 25 Aug 2022 21:39:35 -0500 Subject: [PATCH 7/7] Remove unused import from features/forms --- app/soapbox/features/forms/index.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/app/soapbox/features/forms/index.tsx b/app/soapbox/features/forms/index.tsx index dc9e3faa06..4bab25a5d9 100644 --- a/app/soapbox/features/forms/index.tsx +++ b/app/soapbox/features/forms/index.tsx @@ -1,6 +1,5 @@ import classNames from 'classnames'; import React, { useState, useRef } from 'react'; -import { FormattedMessage } from 'react-intl'; import { v4 as uuidv4 } from 'uuid'; import { Text, Select } from '../../components/ui';