kopia lustrzana https://gitlab.com/soapbox-pub/soapbox
Intl
rodzic
c664844e3c
commit
b706271687
|
@ -1,4 +1,5 @@
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
import { defineMessages, useIntl } from 'react-intl';
|
||||||
import { Link } from 'react-router-dom';
|
import { Link } from 'react-router-dom';
|
||||||
|
|
||||||
import VerificationBadge from 'soapbox/components/verification_badge';
|
import VerificationBadge from 'soapbox/components/verification_badge';
|
||||||
|
@ -9,6 +10,11 @@ import ActionButton from '../ui/components/action-button';
|
||||||
|
|
||||||
import type { Account } from 'soapbox/types/entities';
|
import type { Account } from 'soapbox/types/entities';
|
||||||
|
|
||||||
|
const messages = defineMessages({
|
||||||
|
heading: { id: 'feedSuggestions.heading', defaultMessage: 'Suggested profiles' },
|
||||||
|
viewAll: { id: 'feedSuggestions.viewAll', defaultMessage: 'View all' },
|
||||||
|
});
|
||||||
|
|
||||||
const SuggestionItem = ({ accountId }: { accountId: string }) => {
|
const SuggestionItem = ({ accountId }: { accountId: string }) => {
|
||||||
const account = useAccount(accountId) as Account;
|
const account = useAccount(accountId) as Account;
|
||||||
|
|
||||||
|
@ -52,18 +58,19 @@ const SuggestionItem = ({ accountId }: { accountId: string }) => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const FeedSuggestions = () => {
|
const FeedSuggestions = () => {
|
||||||
|
const intl = useIntl();
|
||||||
const suggestedProfiles = useAppSelector((state) => state.suggestions.items);
|
const suggestedProfiles = useAppSelector((state) => state.suggestions.items);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Card size='lg' variant='rounded'>
|
<Card size='lg' variant='rounded'>
|
||||||
<HStack justifyContent='between' alignItems='center'>
|
<HStack justifyContent='between' alignItems='center'>
|
||||||
<CardTitle title='Suggested profiles' />
|
<CardTitle title={intl.formatMessage(messages.heading)} />
|
||||||
|
|
||||||
<Link
|
<Link
|
||||||
to='/suggestions'
|
to='/suggestions'
|
||||||
className='text-primary-600 dark:text-primary-400 hover:underline'
|
className='text-primary-600 dark:text-primary-400 hover:underline'
|
||||||
>
|
>
|
||||||
View all
|
{intl.formatMessage(messages.viewAll)}
|
||||||
</Link>
|
</Link>
|
||||||
</HStack>
|
</HStack>
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import debounce from 'lodash/debounce';
|
import debounce from 'lodash/debounce';
|
||||||
import React, { useEffect } from 'react';
|
import React, { useEffect } from 'react';
|
||||||
import { FormattedMessage } from 'react-intl';
|
import { defineMessages, FormattedMessage, useIntl } from 'react-intl';
|
||||||
|
|
||||||
import { fetchSuggestions } from 'soapbox/actions/suggestions';
|
import { fetchSuggestions } from 'soapbox/actions/suggestions';
|
||||||
import ScrollableList from 'soapbox/components/scrollable_list';
|
import ScrollableList from 'soapbox/components/scrollable_list';
|
||||||
|
@ -9,8 +9,13 @@ import AccountContainer from 'soapbox/containers/account_container';
|
||||||
import Column from 'soapbox/features/ui/components/column';
|
import Column from 'soapbox/features/ui/components/column';
|
||||||
import { useAppDispatch, useAppSelector, useFeatures } from 'soapbox/hooks';
|
import { useAppDispatch, useAppSelector, useFeatures } from 'soapbox/hooks';
|
||||||
|
|
||||||
|
const messages = defineMessages({
|
||||||
|
heading: { id: 'followRecommendations.heading', defaultMessage: 'Suggested profiles' },
|
||||||
|
});
|
||||||
|
|
||||||
const FollowRecommendations: React.FC = () => {
|
const FollowRecommendations: React.FC = () => {
|
||||||
const dispatch = useAppDispatch();
|
const dispatch = useAppDispatch();
|
||||||
|
const intl = useIntl();
|
||||||
const features = useFeatures();
|
const features = useFeatures();
|
||||||
|
|
||||||
const suggestions = useAppSelector((state) => state.suggestions.items);
|
const suggestions = useAppSelector((state) => state.suggestions.items);
|
||||||
|
@ -31,7 +36,7 @@ const FollowRecommendations: React.FC = () => {
|
||||||
|
|
||||||
if (suggestions.size === 0 && !isLoading) {
|
if (suggestions.size === 0 && !isLoading) {
|
||||||
return (
|
return (
|
||||||
<Column label='Suggested profiles'>
|
<Column label={intl.formatMessage(messages.heading)}>
|
||||||
<Text align='center'>
|
<Text align='center'>
|
||||||
<FormattedMessage id='empty_column.follow_recommendations' defaultMessage='Looks like no suggestions could be generated for you. You can try using search to look for people you might know or explore trending hashtags.' />
|
<FormattedMessage id='empty_column.follow_recommendations' defaultMessage='Looks like no suggestions could be generated for you. You can try using search to look for people you might know or explore trending hashtags.' />
|
||||||
</Text>
|
</Text>
|
||||||
|
@ -40,7 +45,7 @@ const FollowRecommendations: React.FC = () => {
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Column label='Suggested profiles'>
|
<Column label={intl.formatMessage(messages.heading)}>
|
||||||
<Stack space={4}>
|
<Stack space={4}>
|
||||||
<ScrollableList
|
<ScrollableList
|
||||||
isLoading={isLoading}
|
isLoading={isLoading}
|
||||||
|
|
Ładowanie…
Reference in New Issue