Update code to deal with new paths under src
This commit is contained in:
@@ -20,8 +20,8 @@ const SiteLogo: React.FC<ISiteLogo> = ({ className, theme, ...rest }) => {
|
||||
|
||||
/** Soapbox logo. */
|
||||
const soapboxLogo = darkMode
|
||||
? require('assets/images/soapbox-logo-white.svg')
|
||||
: require('assets/images/soapbox-logo.svg');
|
||||
? require('soapbox/assets/images/soapbox-logo-white.svg')
|
||||
: require('soapbox/assets/images/soapbox-logo.svg');
|
||||
|
||||
// Use the right logo if provided, then use fallbacks.
|
||||
const getSrc = () => {
|
||||
|
||||
@@ -18,7 +18,7 @@ const VerificationBadge: React.FC<IVerificationBadge> = ({ className }) => {
|
||||
const soapboxConfig = useSoapboxConfig();
|
||||
|
||||
// Prefer a custom icon if found
|
||||
const icon = soapboxConfig.verifiedIcon || require('assets/icons/verified.svg');
|
||||
const icon = soapboxConfig.verifiedIcon || require('soapbox/assets/icons/verified.svg');
|
||||
|
||||
// Render component based on file extension
|
||||
const Element = icon.endsWith('.svg') ? Icon : 'img';
|
||||
|
||||
@@ -7,7 +7,7 @@ import * as BuildConfig from 'soapbox/build-config';
|
||||
export const custom = (filename: string, fallback: any = {}): any => {
|
||||
if (BuildConfig.NODE_ENV === 'test') return fallback;
|
||||
|
||||
const modules = import.meta.glob('../../custom/*.json', { eager: true });
|
||||
const modules = import.meta.glob('../custom/*.json', { eager: true });
|
||||
const key = `../../custom/${filename}.json`;
|
||||
|
||||
return modules[key] ? modules[key] : fallback;
|
||||
|
||||
@@ -3,8 +3,8 @@ import React from 'react';
|
||||
|
||||
/** Get crypto icon URL by ticker symbol, or fall back to generic icon */
|
||||
const getIcon = (ticker: string): string => {
|
||||
const modules: Record<string, any> = import.meta.glob('../../../../../node_modules/cryptocurrency-icons/svg/color/*.svg', { eager: true });
|
||||
const key = `../../../../../node_modules/cryptocurrency-icons/svg/color/${ticker}.svg`;
|
||||
const modules: Record<string, any> = import.meta.glob('../../../../node_modules/cryptocurrency-icons/svg/color/*.svg', { eager: true });
|
||||
const key = `../../../../node_modules/cryptocurrency-icons/svg/color/${ticker}.svg`;
|
||||
return modules[key]?.default || genericIcon;
|
||||
};
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||
<link href="/manifest.json" rel="manifest">
|
||||
<!--server-generated-meta-->
|
||||
<script type="module" src="./soapbox/main.tsx"></script>
|
||||
<script type="module" src="./main.tsx"></script>
|
||||
</head>
|
||||
<body class="theme-mode-light no-reduce-motion">
|
||||
<div id="soapbox" class="h-full">
|
||||
|
||||
@@ -17,9 +17,9 @@ import '@fontsource/roboto-mono/400.css';
|
||||
import 'line-awesome/dist/font-awesome-line-awesome/css/all.css';
|
||||
import 'react-datepicker/dist/react-datepicker.css';
|
||||
|
||||
import '../soapbox/iframe';
|
||||
import '../styles/application.scss';
|
||||
import '../styles/tailwind.css';
|
||||
import './iframe';
|
||||
import './styles/application.scss';
|
||||
import './styles/tailwind.css';
|
||||
|
||||
import './precheck';
|
||||
import { default as Soapbox } from './containers/soapbox';
|
||||
|
||||
@@ -4,7 +4,7 @@ type MessageModule = { default: MessageJson };
|
||||
/** Import custom messages */
|
||||
const importCustom = async (locale: string): Promise<MessageModule> => {
|
||||
try {
|
||||
return await import(`../../custom/locales/${locale}.json`);
|
||||
return await import(`../custom/locales/${locale}.json`);
|
||||
} catch {
|
||||
return ({ default: {} });
|
||||
}
|
||||
|
||||
@@ -2,8 +2,8 @@ import { Record as ImmutableRecord, fromJS } from 'immutable';
|
||||
|
||||
import { normalizeAccount } from '../account';
|
||||
|
||||
const AVATAR_MISSING = require('assets/images/avatar-missing.png');
|
||||
const HEADER_MISSING = require('assets/images/header-missing.png');
|
||||
const AVATAR_MISSING = require('soapbox/assets/images/avatar-missing.png');
|
||||
const HEADER_MISSING = require('soapbox/assets/images/header-missing.png');
|
||||
|
||||
describe('normalizeAccount()', () => {
|
||||
it('adds base fields', () => {
|
||||
|
||||
@@ -100,7 +100,7 @@ const normalizePleromaLegacyFields = (account: ImmutableMap<string, any>) => {
|
||||
const normalizeAvatar = (account: ImmutableMap<string, any>) => {
|
||||
const avatar = account.get('avatar');
|
||||
const avatarStatic = account.get('avatar_static');
|
||||
const missing = require('assets/images/avatar-missing.png');
|
||||
const missing = require('soapbox/assets/images/avatar-missing.png');
|
||||
|
||||
return account.withMutations(account => {
|
||||
account.set('avatar', avatar || avatarStatic || missing);
|
||||
@@ -112,7 +112,7 @@ const normalizeAvatar = (account: ImmutableMap<string, any>) => {
|
||||
const normalizeHeader = (account: ImmutableMap<string, any>) => {
|
||||
const header = account.get('header');
|
||||
const headerStatic = account.get('header_static');
|
||||
const missing = require('assets/images/header-missing.png');
|
||||
const missing = require('soapbox/assets/images/header-missing.png');
|
||||
|
||||
return account.withMutations(account => {
|
||||
account.set('header', header || headerStatic || missing);
|
||||
|
||||
@@ -53,7 +53,7 @@ export const GroupRecord = ImmutableRecord({
|
||||
const normalizeAvatar = (group: ImmutableMap<string, any>) => {
|
||||
const avatar = group.get('avatar');
|
||||
const avatarStatic = group.get('avatar_static');
|
||||
const missing = require('assets/images/avatar-missing.png');
|
||||
const missing = require('soapbox/assets/images/avatar-missing.png');
|
||||
|
||||
return group.withMutations(group => {
|
||||
group.set('avatar', avatar || avatarStatic || missing);
|
||||
@@ -65,7 +65,7 @@ const normalizeAvatar = (group: ImmutableMap<string, any>) => {
|
||||
const normalizeHeader = (group: ImmutableMap<string, any>) => {
|
||||
const header = group.get('header');
|
||||
const headerStatic = group.get('header_static');
|
||||
const missing = require('assets/images/header-missing.png');
|
||||
const missing = require('soapbox/assets/images/header-missing.png');
|
||||
|
||||
return group.withMutations(group => {
|
||||
group.set('header', header || headerStatic || missing);
|
||||
|
||||
@@ -10,8 +10,8 @@ import { contentSchema, filteredArray, makeCustomEmojiMap } from './utils';
|
||||
|
||||
import type { Resolve } from 'soapbox/utils/types';
|
||||
|
||||
const avatarMissing = require('assets/images/avatar-missing.png');
|
||||
const headerMissing = require('assets/images/header-missing.png');
|
||||
const avatarMissing = require('soapbox/assets/images/avatar-missing.png');
|
||||
const headerMissing = require('soapbox/assets/images/header-missing.png');
|
||||
|
||||
const birthdaySchema = z.string().regex(/^\d{4}-\d{2}-\d{2}$/);
|
||||
|
||||
|
||||
@@ -9,8 +9,8 @@ import { groupRelationshipSchema } from './group-relationship';
|
||||
import { groupTagSchema } from './group-tag';
|
||||
import { filteredArray, makeCustomEmojiMap } from './utils';
|
||||
|
||||
const avatarMissing = require('assets/images/avatar-missing.png');
|
||||
const headerMissing = require('assets/images/header-missing.png');
|
||||
const avatarMissing = require('soapbox/assets/images/avatar-missing.png');
|
||||
const headerMissing = require('soapbox/assets/images/header-missing.png');
|
||||
|
||||
const groupSchema = z.object({
|
||||
avatar: z.string().catch(avatarMissing),
|
||||
|
||||
@@ -37,7 +37,7 @@ export const isRemote = (account: Pick<Account, 'acct'>): boolean => !isLocal(ac
|
||||
const DEFAULT_HEADERS: string[] = [
|
||||
'/headers/original/missing.png', // Mastodon
|
||||
'/images/banner.png', // Pleroma
|
||||
require('assets/images/header-missing.png'), // header not provided by backend
|
||||
require('soapbox/assets/images/header-missing.png'), // header not provided by backend
|
||||
];
|
||||
|
||||
/** Check if the avatar is a default avatar */
|
||||
@@ -49,7 +49,7 @@ export const isDefaultHeader = (url: string) => {
|
||||
const DEFAULT_AVATARS = [
|
||||
'/avatars/original/missing.png', // Mastodon
|
||||
'/images/avi.png', // Pleroma
|
||||
require('assets/images/avatar-missing.png'), // avatar not provided by backend
|
||||
require('soapbox/assets/images/avatar-missing.png'), // avatar not provided by backend
|
||||
];
|
||||
|
||||
/** Check if the avatar is a default avatar */
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { execSync } from 'node:child_process';
|
||||
|
||||
import pkg from '../../../package.json';
|
||||
import pkg from '../../package.json';
|
||||
|
||||
const { CI_COMMIT_TAG, CI_COMMIT_REF_NAME, CI_COMMIT_SHA } = process.env;
|
||||
|
||||
|
||||
@@ -35,21 +35,21 @@ const play = (audio: HTMLAudioElement): void => {
|
||||
const soundCache: Record<Sounds, HTMLAudioElement> = {
|
||||
boop: createAudio([
|
||||
{
|
||||
src: require('../../assets/sounds/boop.ogg'),
|
||||
src: require('../assets/sounds/boop.ogg'),
|
||||
type: 'audio/ogg',
|
||||
},
|
||||
{
|
||||
src: require('../../assets/sounds/boop.mp3'),
|
||||
src: require('../assets/sounds/boop.mp3'),
|
||||
type: 'audio/mpeg',
|
||||
},
|
||||
]),
|
||||
chat: createAudio([
|
||||
{
|
||||
src: require('../../assets/sounds/chat.oga'),
|
||||
src: require('../assets/sounds/chat.oga'),
|
||||
type: 'audio/ogg',
|
||||
},
|
||||
{
|
||||
src: require('../../assets/sounds/chat.mp3'),
|
||||
src: require('../assets/sounds/chat.mp3'),
|
||||
type: 'audio/mpeg',
|
||||
},
|
||||
]),
|
||||
|
||||
Reference in New Issue
Block a user