Organize fonts,images,icon,sounds into 'assets' folder

This commit is contained in:
Chewbacca 2022-11-15 08:23:36 -05:00
parent dad7c22603
commit 8b22ca5f27
41 changed files with 33 additions and 33 deletions

View file

@ -4,7 +4,7 @@ import loadPolyfills from './soapbox/load_polyfills';
require('./soapbox/iframe'); require('./soapbox/iframe');
// @ts-ignore // @ts-ignore
require.context('./images/', true); require.context('./assets/images/', true);
// Load stylesheet // Load stylesheet
require('react-datepicker/dist/react-datepicker.css'); require('react-datepicker/dist/react-datepicker.css');

View file

Before

Width:  |  Height:  |  Size: 6 KiB

After

Width:  |  Height:  |  Size: 6 KiB

View file

Before

Width:  |  Height:  |  Size: 3.3 KiB

After

Width:  |  Height:  |  Size: 3.3 KiB

View file

Before

Width:  |  Height:  |  Size: 302 B

After

Width:  |  Height:  |  Size: 302 B

View file

Before

Width:  |  Height:  |  Size: 4.8 KiB

After

Width:  |  Height:  |  Size: 4.8 KiB

View file

Before

Width:  |  Height:  |  Size: 4 KiB

After

Width:  |  Height:  |  Size: 4 KiB

View file

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

View file

Before

Width:  |  Height:  |  Size: 81 B

After

Width:  |  Height:  |  Size: 81 B

View file

Before

Width:  |  Height:  |  Size: 812 B

After

Width:  |  Height:  |  Size: 812 B

View file

Before

Width:  |  Height:  |  Size: 812 B

After

Width:  |  Height:  |  Size: 812 B

View file

Before

Width:  |  Height:  |  Size: 3.4 KiB

After

Width:  |  Height:  |  Size: 3.4 KiB

View file

Before

Width:  |  Height:  |  Size: 99 B

After

Width:  |  Height:  |  Size: 99 B

View file

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

View file

Before

Width:  |  Height:  |  Size: 1 KiB

After

Width:  |  Height:  |  Size: 1 KiB

View file

Before

Width:  |  Height:  |  Size: 811 B

After

Width:  |  Height:  |  Size: 811 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

View file

@ -97,7 +97,7 @@ const SidebarNavigation = () => {
if (features.publicTimeline && features.federating) { if (features.publicTimeline && features.federating) {
menu.push({ menu.push({
to: '/timeline/fediverse', to: '/timeline/fediverse',
icon: require('icons/fediverse.svg'), icon: require('assets/icons/fediverse.svg'),
text: intl.formatMessage(messages.fediverse), text: intl.formatMessage(messages.fediverse),
}); });
} }

View file

@ -228,7 +228,7 @@ const SidebarMenu: React.FC = (): JSX.Element | null => {
{features.federating && ( {features.federating && (
<SidebarLink <SidebarLink
to='/timeline/fediverse' to='/timeline/fediverse'
icon={require('icons/fediverse.svg')} icon={require('assets/icons/fediverse.svg')}
text={<FormattedMessage id='tabs_bar.fediverse' defaultMessage='Fediverse' />} text={<FormattedMessage id='tabs_bar.fediverse' defaultMessage='Fediverse' />}
onClick={onClose} onClick={onClose}
/> />

View file

@ -18,8 +18,8 @@ const SiteLogo: React.FC<ISiteLogo> = ({ className, theme, ...rest }) => {
/** Soapbox logo. */ /** Soapbox logo. */
const soapboxLogo = darkMode const soapboxLogo = darkMode
? require('images/soapbox-logo-white.svg') ? require('assets/images/soapbox-logo-white.svg')
: require('images/soapbox-logo.svg'); : require('assets/images/soapbox-logo.svg');
// Use the right logo if provided, then use fallbacks. // Use the right logo if provided, then use fallbacks.
const getSrc = () => { const getSrc = () => {

View file

@ -18,7 +18,7 @@ const VerificationBadge: React.FC<IVerificationBadge> = ({ className }) => {
const soapboxConfig = useSoapboxConfig(); const soapboxConfig = useSoapboxConfig();
// Prefer a custom icon if found // Prefer a custom icon if found
const icon = soapboxConfig.verifiedIcon || require('icons/verified.svg'); const icon = soapboxConfig.verifiedIcon || require('assets/icons/verified.svg');
// Render component based on file extension // Render component based on file extension
const Element = icon.endsWith('.svg') ? Icon : 'img'; const Element = icon.endsWith('.svg') ? Icon : 'img';

View file

@ -39,21 +39,21 @@ export default function soundsMiddleware(): ThunkMiddleware {
const soundCache: Record<string, HTMLAudioElement> = { const soundCache: Record<string, HTMLAudioElement> = {
boop: createAudio([ boop: createAudio([
{ {
src: require('../../sounds/boop.ogg'), src: require('../../assets/sounds/boop.ogg'),
type: 'audio/ogg', type: 'audio/ogg',
}, },
{ {
src: require('../../sounds/boop.mp3'), src: require('../../assets/sounds/boop.mp3'),
type: 'audio/mpeg', type: 'audio/mpeg',
}, },
]), ]),
chat: createAudio([ chat: createAudio([
{ {
src: require('../../sounds/chat.oga'), src: require('../../assets/sounds/chat.oga'),
type: 'audio/ogg', type: 'audio/ogg',
}, },
{ {
src: require('../../sounds/chat.mp3'), src: require('../../assets/sounds/chat.mp3'),
type: 'audio/mpeg', type: 'audio/mpeg',
}, },
]), ]),

View file

@ -2,8 +2,8 @@ import { Record as ImmutableRecord, fromJS } from 'immutable';
import { normalizeAccount } from '../account'; import { normalizeAccount } from '../account';
const AVATAR_MISSING = require('images/avatar-missing.png'); const AVATAR_MISSING = require('assets/images/avatar-missing.png');
const HEADER_MISSING = require('images/header-missing.png'); const HEADER_MISSING = require('assets/images/header-missing.png');
describe('normalizeAccount()', () => { describe('normalizeAccount()', () => {
it('adds base fields', () => { it('adds base fields', () => {

View file

@ -98,7 +98,7 @@ const normalizePleromaLegacyFields = (account: ImmutableMap<string, any>) => {
const normalizeAvatar = (account: ImmutableMap<string, any>) => { const normalizeAvatar = (account: ImmutableMap<string, any>) => {
const avatar = account.get('avatar'); const avatar = account.get('avatar');
const avatarStatic = account.get('avatar_static'); const avatarStatic = account.get('avatar_static');
const missing = require('images/avatar-missing.png'); const missing = require('assets/images/avatar-missing.png');
return account.withMutations(account => { return account.withMutations(account => {
account.set('avatar', avatar || avatarStatic || missing); account.set('avatar', avatar || avatarStatic || missing);
@ -110,7 +110,7 @@ const normalizeAvatar = (account: ImmutableMap<string, any>) => {
const normalizeHeader = (account: ImmutableMap<string, any>) => { const normalizeHeader = (account: ImmutableMap<string, any>) => {
const header = account.get('header'); const header = account.get('header');
const headerStatic = account.get('header_static'); const headerStatic = account.get('header_static');
const missing = require('images/header-missing.png'); const missing = require('assets/images/header-missing.png');
return account.withMutations(account => { return account.withMutations(account => {
account.set('header', header || headerStatic || missing); account.set('header', header || headerStatic || missing);

View file

@ -180,21 +180,21 @@ const handlePush = (event: PushEvent) => {
/** Native action to open a status on the device. */ /** Native action to open a status on the device. */
const actionExpand = (preferred_locale: string) => ({ const actionExpand = (preferred_locale: string) => ({
action: 'expand', action: 'expand',
icon: `/${require('../../images/web-push/web-push-icon_expand.png')}`, icon: `/${require('../../assets/images/web-push/web-push-icon_expand.png')}`,
title: formatMessage('status.show_more', preferred_locale), title: formatMessage('status.show_more', preferred_locale),
}); });
/** Native action to repost status. */ /** Native action to repost status. */
const actionReblog = (preferred_locale: string) => ({ const actionReblog = (preferred_locale: string) => ({
action: 'reblog', action: 'reblog',
icon: `/${require('../../images/web-push/web-push-icon_reblog.png')}`, icon: `/${require('../../assets/images/web-push/web-push-icon_reblog.png')}`,
title: formatMessage('status.reblog', preferred_locale), title: formatMessage('status.reblog', preferred_locale),
}); });
/** Native action to like status. */ /** Native action to like status. */
const actionFavourite = (preferred_locale: string) => ({ const actionFavourite = (preferred_locale: string) => ({
action: 'favourite', action: 'favourite',
icon: `/${require('../../images/web-push/web-push-icon_favourite.png')}`, icon: `/${require('../../assets/images/web-push/web-push-icon_favourite.png')}`,
title: formatMessage('status.favourite', preferred_locale), title: formatMessage('status.favourite', preferred_locale),
}); });

View file

@ -135,12 +135,12 @@
position: relative; position: relative;
&.video { &.video {
background-image: url('../images/video-placeholder.png'); background-image: url('../assets/images/video-placeholder.png');
background-size: cover; background-size: cover;
} }
&.audio { &.audio {
background-image: url('../images/audio-placeholder.png'); background-image: url('../assets/images/audio-placeholder.png');
background-size: cover; background-size: cover;
} }
} }

View file

@ -3,26 +3,26 @@
// OpenDyslexic // OpenDyslexic
@font-face { @font-face {
font-family: 'OpenDyslexic'; font-family: 'OpenDyslexic';
src: url('../fonts/OpenDyslexic/OpenDyslexic-Regular.woff2') format('woff2'); src: url('../assets/fonts/OpenDyslexic/OpenDyslexic-Regular.woff2') format('woff2');
} }
@font-face { @font-face {
font-family: 'OpenDyslexic'; font-family: 'OpenDyslexic';
font-weight: bold; font-weight: bold;
src: url('../fonts/OpenDyslexic/OpenDyslexic-Bold.woff2') format('woff2'); src: url('../assets/fonts/OpenDyslexic/OpenDyslexic-Bold.woff2') format('woff2');
} }
@font-face { @font-face {
font-family: 'OpenDyslexic'; font-family: 'OpenDyslexic';
font-weight: bold; font-weight: bold;
font-style: italic; font-style: italic;
src: url('../fonts/OpenDyslexic/OpenDyslexic-Bold-Italic.woff2') format('woff2'); src: url('../assets/fonts/OpenDyslexic/OpenDyslexic-Bold-Italic.woff2') format('woff2');
} }
@font-face { @font-face {
font-family: 'OpenDyslexic'; font-family: 'OpenDyslexic';
font-style: italic; font-style: italic;
src: url('../fonts/OpenDyslexic/OpenDyslexic-Italic.woff2') format('woff2'); src: url('../assets/fonts/OpenDyslexic/OpenDyslexic-Italic.woff2') format('woff2');
} }
// TYPEOGRAPHY MIXINS // TYPEOGRAPHY MIXINS
@ -62,11 +62,11 @@
// Soapbox icon font // Soapbox icon font
@font-face { @font-face {
font-family: 'soapbox'; font-family: 'soapbox';
src: url('../fonts/soapbox/soapbox.eot?pryg6i'); src: url('../assets/fonts/soapbox/soapbox.eot?pryg6i');
src: url('../fonts/soapbox/soapbox.eot?pryg6i#iefix') format('embedded-opentype'), src: url('../assets/fonts/soapbox/soapbox.eot?pryg6i#iefix') format('embedded-opentype'),
url('../fonts/soapbox/soapbox.ttf?pryg6i') format('truetype'), url('../assets/fonts/soapbox/soapbox.ttf?pryg6i') format('truetype'),
url('../fonts/soapbox/soapbox.woff?pryg6i') format('woff'), url('../assets/fonts/soapbox/soapbox.woff?pryg6i') format('woff'),
url('../fonts/soapbox/soapbox.svg?pryg6i#soapbox') format('svg'); url('../assets/fonts/soapbox/soapbox.svg?pryg6i#soapbox') format('svg');
font-weight: normal; font-weight: normal;
font-style: normal; font-style: normal;
} }

View file

@ -232,7 +232,7 @@ article:last-child > .domain {
.image-loader__preview-canvas { .image-loader__preview-canvas {
max-width: $media-modal-media-max-width; max-width: $media-modal-media-max-width;
max-height: $media-modal-media-max-height; max-height: $media-modal-media-max-height;
background: url('../images/void.png') repeat; background: url('../assets/images/void.png') repeat;
object-fit: contain; object-fit: contain;
} }

View file

@ -11,7 +11,7 @@ const rules: RuleSetRule[] = [{
test: /\.(png|svg)/, test: /\.(png|svg)/,
type: 'asset/resource', type: 'asset/resource',
include: [ include: [
resolve('app', 'images'), resolve('app', 'assets', 'images'),
resolve('node_modules', 'emoji-datasource'), resolve('node_modules', 'emoji-datasource'),
], ],
generator: { generator: {
@ -21,7 +21,7 @@ const rules: RuleSetRule[] = [{
test: /\.(ttf|eot|svg|woff|woff2)/, test: /\.(ttf|eot|svg|woff|woff2)/,
type: 'asset/resource', type: 'asset/resource',
include: [ include: [
resolve('app', 'fonts'), resolve('app', 'assets', 'fonts'),
resolve('node_modules', 'fork-awesome'), resolve('node_modules', 'fork-awesome'),
resolve('node_modules', 'line-awesome'), resolve('node_modules', 'line-awesome'),
resolve('node_modules', '@fontsource'), resolve('node_modules', '@fontsource'),
@ -32,7 +32,7 @@ const rules: RuleSetRule[] = [{
}, { }, {
test: /\.(ogg|oga|mp3)/, test: /\.(ogg|oga|mp3)/,
type: 'asset/resource', type: 'asset/resource',
include: resolve('app', 'sounds'), include: resolve('app', 'assets', 'sounds'),
generator: { generator: {
filename: 'packs/sounds/[name]-[contenthash:8][ext]', filename: 'packs/sounds/[name]-[contenthash:8][ext]',
}, },
@ -46,7 +46,7 @@ const rules: RuleSetRule[] = [{
}, { }, {
test: /\.svg$/, test: /\.svg$/,
type: 'asset/resource', type: 'asset/resource',
include: resolve('app', 'icons'), include: resolve('app', 'assets', 'icons'),
generator: { generator: {
filename: 'packs/icons/[name]-[contenthash:8][ext]', filename: 'packs/icons/[name]-[contenthash:8][ext]',
}, },