diff options
Diffstat (limited to 'web/source/settings/admin')
| -rw-r--r-- | web/source/settings/admin/emoji.js | 57 | ||||
| -rw-r--r-- | web/source/settings/admin/federation.js | 11 | 
2 files changed, 39 insertions, 29 deletions
| diff --git a/web/source/settings/admin/emoji.js b/web/source/settings/admin/emoji.js index 1ef4a54a3..ad7fcab06 100644 --- a/web/source/settings/admin/emoji.js +++ b/web/source/settings/admin/emoji.js @@ -30,21 +30,11 @@ const { formFields } = require("../components/form-fields");  const api = require("../lib/api");  const adminActions = require("../redux/reducers/admin").actions;  const submit = require("../lib/submit"); +const BackButton = require("../components/back-button");  const base = "/settings/admin/custom-emoji";  module.exports = function CustomEmoji() { -	return ( -		<Switch> -			<Route path={`${base}/:emojiId`}> -				<EmojiDetailWrapped /> -			</Route> -			<EmojiOverview /> -		</Switch> -	); -}; - -function EmojiOverview() {  	const dispatch = Redux.useDispatch();  	const [loaded, setLoaded] = React.useState(false); @@ -74,12 +64,25 @@ function EmojiOverview() {  	return (  		<> -			<h1>Custom Emoji</h1> -			<EmojiList/> -			<NewEmoji/>  			{errorMsg.length > 0 &&   				<div className="error accent">{errorMsg}</div>  			} +			<Switch> +				<Route path={`${base}/:emojiId`}> +					<EmojiDetailWrapped /> +				</Route> +				<EmojiOverview /> +			</Switch> +		</> +	); +}; + +function EmojiOverview() { +	return ( +		<> +			<h1>Custom Emoji</h1> +			<EmojiList/> +			<NewEmoji/>  		</>  	);  } @@ -176,10 +179,10 @@ function EmojiCategory({category, entries}) {  			<div className="emoji-group">  				{entries.map((e) => {  					return ( -						// <Link key={e.static_url} to={`${base}/${e.shortcode}`}> -						<Link key={e.static_url} to={`${base}`}> +						<Link key={e.id} to={`${base}/${e.id}`}> +							{/* <Link key={e.static_url} to={`${base}`}> */}  							<a> -								<img src={e.static_url} alt={e.shortcode} title={`:${e.shortcode}:`}/> +								<img src={e.url} alt={e.shortcode} title={`:${e.shortcode}:`}/>  							</a>  						</Link>  					); @@ -195,6 +198,13 @@ function EmojiDetailWrapped() {  		 inputs get re-created on every change, causing them to lose focus, and bad performance  	*/  	let [_match, {emojiId}] = useRoute(`${base}/:emojiId`); +	const emojiById = Redux.useSelector((state) => state.admin.emojiById); +	const emoji = emojiById[emojiId]; +	if (emoji == undefined) { +		return ( +			<h1><BackButton to={base}/> Custom Emoji: </h1> +		); +	}  	function alterEmoji([key, val]) {  		return adminActions.updateDomainBlockVal([emojiId, key, val]); @@ -202,11 +212,18 @@ function EmojiDetailWrapped() {  	const fields = formFields(alterEmoji, (state) => state.admin.blockedInstances[emojiId]); -	return <EmojiDetail id={emojiId} Form={fields} />; +	return <EmojiDetail emoji={emoji} Form={fields} />;  } -function EmojiDetail({id, Form}) { +function EmojiDetail({emoji, Form}) {  	return ( -		"Not implemented yet" +		<div> +			<h1><BackButton to={base}/> Custom Emoji: {emoji.shortcode}</h1> +			<p> +				Editing custom emoji isn't implemented yet.<br/> +				<a target="_blank" rel="noreferrer" href="https://github.com/superseriousbusiness/gotosocial/issues/797">View implementation progress.</a> +			</p> +			<img src={emoji.url} alt={emoji.shortcode} title={`:${emoji.shortcode}:`}/> +		</div>  	);  }
\ No newline at end of file diff --git a/web/source/settings/admin/federation.js b/web/source/settings/admin/federation.js index 7afc3c699..99f10e69e 100644 --- a/web/source/settings/admin/federation.js +++ b/web/source/settings/admin/federation.js @@ -29,6 +29,7 @@ const { formFields } = require("../components/form-fields");  const api = require("../lib/api");  const adminActions = require("../redux/reducers/admin").actions;  const submit = require("../lib/submit"); +const BackButton = require("../components/back-button");  const base = "/settings/admin/federation"; @@ -280,14 +281,6 @@ function BulkBlocking() {  	);  } -function BackButton() { -	return ( -		<Link to={base}> -			<a className="button">< back</a> -		</Link> -	); -} -  function InstancePageWrapped() {  	/* We wrap the component to generate formFields with a setter depending on the domain  		 if formFields() is used inside the same component that is re-rendered with their state, @@ -345,7 +338,7 @@ function InstancePage({domain, Form}) {  	return (  		<div> -			<h1><BackButton/> Federation settings for: {domain}</h1> +			<h1><BackButton to={base}/> Federation settings for: {domain}</h1>  			{entry.new && "No stored block yet, you can add one below:"}  			<Form.TextArea | 
