|
|
@ -7,6 +7,7 @@ import { patchMe } from 'soapbox/actions/me';
|
|
|
|
import snackbar from 'soapbox/actions/snackbar';
|
|
|
|
import snackbar from 'soapbox/actions/snackbar';
|
|
|
|
import { Avatar, Button, Card, CardBody, Icon, Spinner, Stack, Text } from 'soapbox/components/ui';
|
|
|
|
import { Avatar, Button, Card, CardBody, Icon, Spinner, Stack, Text } from 'soapbox/components/ui';
|
|
|
|
import { useOwnAccount } from 'soapbox/hooks';
|
|
|
|
import { useOwnAccount } from 'soapbox/hooks';
|
|
|
|
|
|
|
|
import { isDefaultAvatar } from 'soapbox/utils/accounts';
|
|
|
|
import resizeImage from 'soapbox/utils/resize-image';
|
|
|
|
import resizeImage from 'soapbox/utils/resize-image';
|
|
|
|
|
|
|
|
|
|
|
|
import type { AxiosError } from 'axios';
|
|
|
|
import type { AxiosError } from 'axios';
|
|
|
@ -15,17 +16,6 @@ const messages = defineMessages({
|
|
|
|
error: { id: 'onboarding.error', defaultMessage: 'An unexpected error occurred. Please try again or skip this step.' },
|
|
|
|
error: { id: 'onboarding.error', defaultMessage: 'An unexpected error occurred. Please try again or skip this step.' },
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
/** Default avatar filenames from various backends */
|
|
|
|
|
|
|
|
const DEFAULT_AVATARS = [
|
|
|
|
|
|
|
|
'/avatars/original/missing.png', // Mastodon
|
|
|
|
|
|
|
|
'/images/avi.png', // Pleroma
|
|
|
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** Check if the avatar is a default avatar */
|
|
|
|
|
|
|
|
const isDefaultAvatar = (url: string) => {
|
|
|
|
|
|
|
|
return DEFAULT_AVATARS.every(avatar => url.endsWith(avatar));
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const AvatarSelectionStep = ({ onNext }: { onNext: () => void }) => {
|
|
|
|
const AvatarSelectionStep = ({ onNext }: { onNext: () => void }) => {
|
|
|
|
const dispatch = useDispatch();
|
|
|
|
const dispatch = useDispatch();
|
|
|
|
const account = useOwnAccount();
|
|
|
|
const account = useOwnAccount();
|
|
|
|