ICU book workflow

This commit is contained in:
Fedor Indutny
2025-03-13 12:52:08 -07:00
committed by GitHub
parent 5a9253bd44
commit de19bb07fa
211 changed files with 503 additions and 649 deletions

61
.github/workflows/icu-book.yml vendored Normal file
View File

@@ -0,0 +1,61 @@
# Copyright 2025 Signal Messenger, LLC
# SPDX-License-Identifier: AGPL-3.0-only
name: ICU Book
on:
workflow_dispatch:
push:
tags:
- 'v[0-9]+.[0-9]+.*'
jobs:
build-icu-book:
name: Build ICU Book
runs-on: ubuntu-latest-8-cores
if: ${{ github.repository == 'signalapp/Signal-Desktop-Private' }}
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 10.3.0
- name: Setup node.js
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: 'pnpm'
cache-dependency-path: 'pnpm-lock.yaml'
- name: Cache .electron-gyp
uses: actions/cache@v4
with:
path: ~/.electron-gyp
key: electron-gyp-${{ runner.os }}-${{ hashFiles('pnpm-lock.yaml') }}
- name: Setup sccache
uses: mozilla-actions/sccache-action@v0.0.7
- name: Restore sccache
uses: actions/cache@v4
id: cache-sccache
with:
path: ${{ env.SCCACHE_PATH }}
key: sccache-${{ runner.os }}-${{ hashFiles('pnpm-lock.yaml', 'patches/**') }}
- name: Install Desktop node_modules
run: pnpm install
env:
CC: sccache gcc
CXX: sccache g++
SCCACHE_GHA_ENABLED: "true"
NPM_CONFIG_LOGLEVEL: verbose
- run: pnpm run build:storybook
- run: ./node_modules/.bin/playwright install chromium
- run: ./node_modules/.bin/run-p --race test:storybook:serve test:storybook:test
env:
ARTIFACTS_DIR: stories/data
- run: pnpm run build:esbuild
- run: node ts/scripts/compile-stories-icu-lookup.js stories
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: desktop-${{ github.ref_name }}-icu
path: stories

View File

@@ -0,0 +1,71 @@
<!-- Copyright 2025 Signal Messenger, LLC -->
<!-- SPDX-License-Identifier: AGPL-3.0-only -->
<!doctype html>
<html>
<head>
<style>
details {
padding-inline-start: 1em;
}
img {
max-width: 800px;
}
</style>
<title>Signal Desktop ICU</title>
</head>
<body>
<input type="search" placeholder="ICU string" id="search" />
<p id="disclaimer"></p>
<section id="results"></section>
<script>
const index = %INDEX%;
const results = document.getElementById('results');
const search = document.getElementById('search');
const disclaimer = document.getElementById('disclaimer');
function onSearch() {
results.replaceChildren();
const reg = new RegExp(search.value, 'i');
const allFiltered = index
.filter(([key, message]) => reg.test(key) || reg.test(message));
const filtered = allFiltered.slice(0, 100);
disclaimer.textContent = filtered.length < allFiltered.length ?
'Showing the first 100 results:' : 'All results:';
for (const [key, message, stories] of filtered) {
const details = document.createElement('details');
const summary = document.createElement('summary');
summary.textContent = `${key}: "${message}"`;
details.appendChild(summary);
for (const storyId of stories) {
const story = document.createElement('details');
details.appendChild(story);
const title = document.createElement('summary');
title.textContent = storyId;
story.appendChild(title);
const img = document.createElement('img');
img.src = `data/${encodeURIComponent(storyId)}/screenshot.png`;
img.loading = 'lazy';
story.appendChild(img);
}
results.appendChild(details);
}
}
document.getElementById('search').addEventListener('input', onSearch);
onSearch();
</script>
</body>
</html>

View File

@@ -16,6 +16,7 @@ import { setupI18n } from '../ts/util/setupI18n';
import { HourCyclePreference } from '../ts/types/I18N';
import { Provider } from 'react-redux';
import { Store, combineReducers, createStore } from 'redux';
import { Globals } from '@react-spring/web';
import { StateType } from '../ts/state/reducer';
import {
ScrollerLockContext,
@@ -130,6 +131,15 @@ window.SignalContext = {
const result = parseUnknown(LocaleEmojiListSchema, json);
return result;
},
// For test-runner
_skipAnimation: () => {
Globals.assign({
skipAnimation: true,
});
},
_trackICUStrings: () => i18n.trackUsage(),
_stopTrackingICUStrings: () => i18n.stopTrackingUsage(),
};
window.i18n = i18n;

52
.storybook/test-runner.ts Normal file
View File

@@ -0,0 +1,52 @@
// Copyright 2025 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
import { mkdir, writeFile } from 'node:fs/promises';
import { join } from 'node:path';
import {
type TestRunnerConfig,
waitForPageReady,
} from '@storybook/test-runner';
const { ARTIFACTS_DIR } = process.env;
const config: TestRunnerConfig = {
async preVisit(page) {
if (!ARTIFACTS_DIR) {
return;
}
await page.evaluate('window.SignalContext._skipAnimation()');
await page.evaluate('window.SignalContext._trackICUStrings()');
},
async postVisit(page, context) {
if (context.hasFailure) {
return;
}
if (!ARTIFACTS_DIR) {
return;
}
await waitForPageReady(page);
const result = await page.evaluate(
'window.SignalContext._stopTrackingICUStrings()'
);
// No strings - no file
if (result.length === 0) {
return;
}
const image = await page.screenshot({ fullPage: true });
const dir = join(ARTIFACTS_DIR, context.id);
await mkdir(dir, { recursive: true });
await Promise.all([
writeFile(join(dir, 'screenshot.png'), image),
writeFile(join(dir, 'strings.json'), JSON.stringify(result)),
]);
},
};
export default config;

View File

@@ -74,7 +74,7 @@
"build:storybook": "pnpm run build-protobuf && cross-env SIGNAL_ENV=storybook storybook build",
"test:storybook": "pnpm run build:storybook && run-p --race test:storybook:*",
"test:storybook:serve": "http-server storybook-static --port 6006 --silent",
"test:storybook:test": "wait-on http://127.0.0.1:6006/ --timeout 5000 && test-storybook",
"test:storybook:test": "wait-on http://127.0.0.1:6006/ --timeout 5000 && test-storybook --testTimeout 60000",
"build": "run-s --print-label generate build:esbuild:prod build:release",
"build-win32-all": "run-s --print-label generate build:esbuild:prod build:release-win32-all",
"build-linux": "run-s generate build:esbuild:prod && pnpm run build:release --publish=never",
@@ -236,7 +236,7 @@
"@storybook/react": "8.4.4",
"@storybook/react-webpack5": "8.4.4",
"@storybook/test": "8.4.4",
"@storybook/test-runner": "0.19.1",
"@storybook/test-runner": "0.22.0",
"@storybook/types": "8.1.11",
"@types/backbone": "1.4.22",
"@types/blueimp-load-image": "5.16.6",

37
pnpm-lock.yaml generated
View File

@@ -477,8 +477,8 @@ importers:
specifier: 8.4.4
version: 8.4.4(storybook@8.4.4(bufferutil@4.0.9)(prettier@3.3.3)(utf-8-validate@5.0.10))
'@storybook/test-runner':
specifier: 0.19.1
version: 0.19.1(@swc/helpers@0.5.15)(@types/node@20.17.6)(debug@4.3.7)(storybook@8.4.4(bufferutil@4.0.9)(prettier@3.3.3)(utf-8-validate@5.0.10))(ts-node@10.9.2(@swc/core@1.10.16(@swc/helpers@0.5.15))(@types/node@20.17.6)(typescript@5.6.3))
specifier: 0.22.0
version: 0.22.0(@swc/helpers@0.5.15)(@types/node@20.17.6)(debug@4.3.7)(storybook@8.4.4(bufferutil@4.0.9)(prettier@3.3.3)(utf-8-validate@5.0.10))(ts-node@10.9.2(@swc/core@1.10.16(@swc/helpers@0.5.15))(@types/node@20.17.6)(typescript@5.6.3))
'@storybook/types':
specifier: 8.1.11
version: 8.1.11
@@ -2642,11 +2642,6 @@ packages:
peerDependencies:
storybook: ^8.2.0 || ^8.3.0-0 || ^8.4.0-0 || ^8.5.0-0 || ^8.6.0-0
'@storybook/core-common@8.5.5':
resolution: {integrity: sha512-CxNfFMMXTCta9GiyhIXIYkbyHZz2owbJV1slIxcQgQVkodN4iyroY0mOps8o2ArE9v8tApumdiFv/NoDprsh4A==}
peerDependencies:
storybook: ^8.2.0 || ^8.3.0-0 || ^8.4.0-0 || ^8.5.0-0 || ^8.6.0-0
'@storybook/core-events@8.1.11':
resolution: {integrity: sha512-vXaNe2KEW9BGlLrg0lzmf5cJ0xt+suPjWmEODH5JqBbrdZ67X6ApA2nb6WcxDQhykesWCuFN5gp1l+JuDOBi7A==}
@@ -2663,11 +2658,6 @@ packages:
prettier:
optional: true
'@storybook/csf-tools@8.5.5':
resolution: {integrity: sha512-Aw1bhfFIhDF1uKykDWcmdYf5R0pxfF1/1ig2UcjQrfH20EoPRKN666DlwHiJjdtvFzQlhemh3T1FqCvkI6pR6A==}
peerDependencies:
storybook: ^8.2.0 || ^8.3.0-0 || ^8.4.0-0 || ^8.5.0-0 || ^8.6.0-0
'@storybook/csf@0.1.11':
resolution: {integrity: sha512-dHYFQH3mA+EtnCkHXzicbLgsvzYjcDJ1JWsogbItZogkPHgSJM/Wr71uMkcvw8v9mmCyP4NpXJuu6bPoVsOnzg==}
@@ -2741,10 +2731,12 @@ packages:
typescript:
optional: true
'@storybook/test-runner@0.19.1':
resolution: {integrity: sha512-Nc4djXw3Lv3AAXg6TJ7yVTeuMryjMsTDd8GCbE/PStU602rpe8syEqElz78GPoJqB1VYWQ3T9pcu93MKyHT+xQ==}
'@storybook/test-runner@0.22.0':
resolution: {integrity: sha512-fKY6MTE/bcvMaulKXy+z0fPmRXJx1REkYMOMcGn8zn6uffyBigGgaVf/sZ+AZfibwvjzg/StWhJ9HvAM8pc14g==}
engines: {node: ^16.10.0 || ^18.0.0 || >=20.0.0}
hasBin: true
peerDependencies:
storybook: ^0.0.0-0 || ^8.2.0 || ^8.3.0-0 || ^8.4.0-0 || ^8.5.0-0 || ^8.6.0-0 || ^9.0.0-0
'@storybook/test@8.4.4':
resolution: {integrity: sha512-tmJd+lxl3MC0Xdu1KW/69V8tibv98OvdopxGqfVR0x5dkRHM3sFK/tv1ZJAUeronlvRyhGySOu1tHUrMjcNqyA==}
@@ -12453,10 +12445,6 @@ snapshots:
dependencies:
storybook: 8.4.4(bufferutil@4.0.9)(prettier@3.3.3)(utf-8-validate@5.0.10)
'@storybook/core-common@8.5.5(storybook@8.4.4(bufferutil@4.0.9)(prettier@3.3.3)(utf-8-validate@5.0.10))':
dependencies:
storybook: 8.4.4(bufferutil@4.0.9)(prettier@3.3.3)(utf-8-validate@5.0.10)
'@storybook/core-events@8.1.11':
dependencies:
'@storybook/csf': 0.1.11
@@ -12488,10 +12476,6 @@ snapshots:
- supports-color
- utf-8-validate
'@storybook/csf-tools@8.5.5(storybook@8.4.4(bufferutil@4.0.9)(prettier@3.3.3)(utf-8-validate@5.0.10))':
dependencies:
storybook: 8.4.4(bufferutil@4.0.9)(prettier@3.3.3)(utf-8-validate@5.0.10)
'@storybook/csf@0.1.11':
dependencies:
type-fest: 2.19.0
@@ -12594,17 +12578,14 @@ snapshots:
'@storybook/test': 8.4.4(storybook@8.4.4(bufferutil@4.0.9)(prettier@3.3.3)(utf-8-validate@5.0.10))
typescript: 5.6.3
'@storybook/test-runner@0.19.1(@swc/helpers@0.5.15)(@types/node@20.17.6)(debug@4.3.7)(storybook@8.4.4(bufferutil@4.0.9)(prettier@3.3.3)(utf-8-validate@5.0.10))(ts-node@10.9.2(@swc/core@1.10.16(@swc/helpers@0.5.15))(@types/node@20.17.6)(typescript@5.6.3))':
'@storybook/test-runner@0.22.0(@swc/helpers@0.5.15)(@types/node@20.17.6)(debug@4.3.7)(storybook@8.4.4(bufferutil@4.0.9)(prettier@3.3.3)(utf-8-validate@5.0.10))(ts-node@10.9.2(@swc/core@1.10.16(@swc/helpers@0.5.15))(@types/node@20.17.6)(typescript@5.6.3))':
dependencies:
'@babel/core': 7.26.0
'@babel/generator': 7.26.8
'@babel/template': 7.26.8
'@babel/types': 7.26.8
'@jest/types': 29.6.3
'@storybook/core-common': 8.5.5(storybook@8.4.4(bufferutil@4.0.9)(prettier@3.3.3)(utf-8-validate@5.0.10))
'@storybook/csf': 0.1.11
'@storybook/csf-tools': 8.5.5(storybook@8.4.4(bufferutil@4.0.9)(prettier@3.3.3)(utf-8-validate@5.0.10))
'@storybook/preview-api': 8.4.4(storybook@8.4.4(bufferutil@4.0.9)(prettier@3.3.3)(utf-8-validate@5.0.10))
'@swc/core': 1.10.16(@swc/helpers@0.5.15)
'@swc/jest': 0.2.37(@swc/core@1.10.16(@swc/helpers@0.5.15))
expect-playwright: 0.8.0
@@ -12618,13 +12599,13 @@ snapshots:
jest-watch-typeahead: 2.2.2(jest@29.7.0(@types/node@20.17.6)(ts-node@10.9.2(@swc/core@1.10.16(@swc/helpers@0.5.15))(@types/node@20.17.6)(typescript@5.6.3)))
nyc: 15.1.0
playwright: 1.45.0
storybook: 8.4.4(bufferutil@4.0.9)(prettier@3.3.3)(utf-8-validate@5.0.10)
transitivePeerDependencies:
- '@swc/helpers'
- '@types/node'
- babel-plugin-macros
- debug
- node-notifier
- storybook
- supports-color
- ts-node
@@ -20933,7 +20914,7 @@ snapshots:
wide-align@1.1.5:
dependencies:
string-width: 1.0.2
string-width: 4.2.3
widest-line@2.0.1:
dependencies:

View File

@@ -3,13 +3,11 @@
import React from 'react';
import { action } from '@storybook/addon-actions';
import { setupI18n } from '../util/setupI18n';
import enMessages from '../../_locales/en/messages.json';
import type { ComponentMeta } from '../storybook/types';
import type { AboutProps } from './About';
import { About } from './About';
const i18n = setupI18n('en', enMessages);
const { i18n } = window.SignalContext;
export default {
title: 'Components/About',

View File

@@ -6,15 +6,13 @@ import React from 'react';
import { action } from '@storybook/addon-actions';
import type { Meta } from '@storybook/react';
import { setupI18n } from '../util/setupI18n';
import enMessages from '../../_locales/en/messages.json';
import type { PropsType } from './AddGroupMemberErrorDialog';
import {
AddGroupMemberErrorDialog,
AddGroupMemberErrorDialogMode,
} from './AddGroupMemberErrorDialog';
const i18n = setupI18n('en', enMessages);
const { i18n } = window.SignalContext;
export default {
title: 'Components/AddGroupMemberErrorDialog',

View File

@@ -6,15 +6,13 @@ import type { Meta, StoryFn } from '@storybook/react';
import { action } from '@storybook/addon-actions';
import type { Props } from './AddUserToAnotherGroupModal';
import enMessages from '../../_locales/en/messages.json';
import {
getDefaultConversation,
getDefaultGroup,
} from '../test-both/helpers/getDefaultConversation';
import { setupI18n } from '../util/setupI18n';
import { AddUserToAnotherGroupModal } from './AddUserToAnotherGroupModal';
const i18n = setupI18n('en', enMessages);
const { i18n } = window.SignalContext;
export default {
title: 'Components/AddUserToAnotherGroupModal',

View File

@@ -4,12 +4,10 @@
import React from 'react';
import { action } from '@storybook/addon-actions';
import type { Meta } from '@storybook/react';
import { setupI18n } from '../util/setupI18n';
import enMessages from '../../_locales/en/messages.json';
import type { PropsType } from './Alert';
import { Alert } from './Alert';
const i18n = setupI18n('en', enMessages);
const { i18n } = window.SignalContext;
export default {
title: 'Components/Alert',

View File

@@ -3,8 +3,6 @@
import React from 'react';
import { action } from '@storybook/addon-actions';
import { setupI18n } from '../util/setupI18n';
import enMessages from '../../_locales/en/messages.json';
import type { PropsType } from './AttachmentNotAvailableModal';
import {
AttachmentNotAvailableModal,
@@ -12,7 +10,7 @@ import {
} from './AttachmentNotAvailableModal';
import type { ComponentMeta } from '../storybook/types';
const i18n = setupI18n('en', enMessages);
const { i18n } = window.SignalContext;
export default {
title: 'Components/AttachmentNotAvailableModal',

View File

@@ -8,15 +8,13 @@ import { isBoolean } from 'lodash';
import { expect, fn, within, userEvent } from '@storybook/test';
import type { AvatarColorType } from '../types/Colors';
import type { Props } from './Avatar';
import enMessages from '../../_locales/en/messages.json';
import { Avatar, AvatarBlur, AvatarSize } from './Avatar';
import { AvatarColors } from '../types/Colors';
import { HasStories } from '../types/Stories';
import { ThemeType } from '../types/Util';
import { getFakeBadge } from '../test-both/helpers/getFakeBadge';
import { setupI18n } from '../util/setupI18n';
const i18n = setupI18n('en', enMessages);
const { i18n } = window.SignalContext;
export default {
title: 'Components/Avatar',

View File

@@ -5,14 +5,11 @@ import React from 'react';
import { action } from '@storybook/addon-actions';
import type { Meta } from '@storybook/react';
import { setupI18n } from '../util/setupI18n';
import enMessages from '../../_locales/en/messages.json';
import type { PropsType } from './AvatarColorPicker';
import { AvatarColorPicker } from './AvatarColorPicker';
import { AvatarColors } from '../types/Colors';
const i18n = setupI18n('en', enMessages);
const { i18n } = window.SignalContext;
const createProps = (overrideProps: Partial<PropsType> = {}): PropsType => ({
i18n,

View File

@@ -5,16 +5,13 @@ import React from 'react';
import { action } from '@storybook/addon-actions';
import type { Meta } from '@storybook/react';
import { setupI18n } from '../util/setupI18n';
import enMessages from '../../_locales/en/messages.json';
import { AvatarColors } from '../types/Colors';
import type { PropsType } from './AvatarEditor';
import { AvatarEditor } from './AvatarEditor';
import { getDefaultAvatars } from '../types/Avatar';
import { createAvatarData } from '../util/createAvatarData';
const i18n = setupI18n('en', enMessages);
const { i18n } = window.SignalContext;
const createProps = (overrideProps: Partial<PropsType> = {}): PropsType => ({
avatarColor: overrideProps.avatarColor || AvatarColors[9],

View File

@@ -5,16 +5,13 @@ import React from 'react';
import { action } from '@storybook/addon-actions';
import type { Meta } from '@storybook/react';
import { setupI18n } from '../util/setupI18n';
import enMessages from '../../_locales/en/messages.json';
import type { PropsType } from './AvatarIconEditor';
import { AvatarIconEditor } from './AvatarIconEditor';
import { GroupAvatarIcons, PersonalAvatarIcons } from '../types/Avatar';
import { AvatarColors } from '../types/Colors';
import { createAvatarData } from '../util/createAvatarData';
const i18n = setupI18n('en', enMessages);
const { i18n } = window.SignalContext;
const createProps = (overrideProps: Partial<PropsType> = {}): PropsType => ({
avatarData: overrideProps.avatarData || createAvatarData({}),

View File

@@ -4,14 +4,12 @@
import React from 'react';
import { action } from '@storybook/addon-actions';
import type { Meta } from '@storybook/react';
import enMessages from '../../_locales/en/messages.json';
import { AvatarColors } from '../types/Colors';
import type { PropsType } from './AvatarLightbox';
import { AvatarLightbox } from './AvatarLightbox';
import { setupI18n } from '../util/setupI18n';
import { getDefaultConversation } from '../test-both/helpers/getDefaultConversation';
const i18n = setupI18n('en', enMessages);
const { i18n } = window.SignalContext;
export default {
title: 'Components/AvatarLightbox',

View File

@@ -6,12 +6,10 @@ import React from 'react';
import { action } from '@storybook/addon-actions';
import type { Meta } from '@storybook/react';
import enMessages from '../../_locales/en/messages.json';
import type { PropsType } from './AvatarModalButtons';
import { AvatarModalButtons } from './AvatarModalButtons';
import { setupI18n } from '../util/setupI18n';
const i18n = setupI18n('en', enMessages);
const { i18n } = window.SignalContext;
const createProps = (overrideProps: Partial<PropsType> = {}): PropsType => ({
hasChanges: Boolean(overrideProps.hasChanges),

View File

@@ -10,10 +10,8 @@ import type { Meta } from '@storybook/react';
import type { PropsType } from './AvatarPreview';
import { AvatarPreview } from './AvatarPreview';
import { AvatarColors } from '../types/Colors';
import { setupI18n } from '../util/setupI18n';
import enMessages from '../../_locales/en/messages.json';
const i18n = setupI18n('en', enMessages);
const { i18n } = window.SignalContext;
const TEST_IMAGE = new Uint8Array(
chunk(

View File

@@ -5,14 +5,11 @@ import React from 'react';
import { action } from '@storybook/addon-actions';
import type { Meta } from '@storybook/react';
import { setupI18n } from '../util/setupI18n';
import enMessages from '../../_locales/en/messages.json';
import type { PropsType } from './AvatarTextEditor';
import { AvatarTextEditor } from './AvatarTextEditor';
import { AvatarColors } from '../types/Colors';
const i18n = setupI18n('en', enMessages);
const { i18n } = window.SignalContext;
const createProps = (overrideProps: Partial<PropsType> = {}): PropsType => ({
avatarData: overrideProps.avatarData,

View File

@@ -5,13 +5,10 @@ import React from 'react';
import { action } from '@storybook/addon-actions';
import type { Meta } from '@storybook/react';
import { setupI18n } from '../util/setupI18n';
import enMessages from '../../_locales/en/messages.json';
import type { PropsType } from './AvatarUploadButton';
import { AvatarUploadButton } from './AvatarUploadButton';
const i18n = setupI18n('en', enMessages);
const { i18n } = window.SignalContext;
const createProps = (overrideProps: Partial<PropsType> = {}): PropsType => ({
className: overrideProps.className || '',

View File

@@ -5,12 +5,10 @@ import React, { type ComponentProps } from 'react';
import type { Meta } from '@storybook/react';
import { action } from '@storybook/addon-actions';
import { setupI18n } from '../util/setupI18n';
import enMessages from '../../_locales/en/messages.json';
import { BackupMediaDownloadProgress } from './BackupMediaDownloadProgress';
import { KIBIBYTE } from '../types/AttachmentSize';
const i18n = setupI18n('en', enMessages);
const { i18n } = window.SignalContext;
type PropsType = ComponentProps<typeof BackupMediaDownloadProgress>;

View File

@@ -6,15 +6,13 @@ import React from 'react';
import { action } from '@storybook/addon-actions';
import type { Meta } from '@storybook/react';
import { setupI18n } from '../util/setupI18n';
import enMessages from '../../_locales/en/messages.json';
import { getFakeBadge, getFakeBadges } from '../test-both/helpers/getFakeBadge';
import { repeat, zipObject } from '../util/iterables';
import { BadgeImageTheme } from '../badges/BadgeImageTheme';
import type { PropsType } from './BadgeDialog';
import { BadgeDialog } from './BadgeDialog';
const i18n = setupI18n('en', enMessages);
const { i18n } = window.SignalContext;
export default {
title: 'Components/BadgeDialog',

View File

@@ -6,15 +6,13 @@ import React from 'react';
import { action } from '@storybook/addon-actions';
import type { Meta } from '@storybook/react';
import enMessages from '../../_locales/en/messages.json';
import { AvatarColors } from '../types/Colors';
import { GroupAvatarIcons, PersonalAvatarIcons } from '../types/Avatar';
import type { PropsType } from './BetterAvatar';
import { BetterAvatar } from './BetterAvatar';
import { createAvatarData } from '../util/createAvatarData';
import { setupI18n } from '../util/setupI18n';
const i18n = setupI18n('en', enMessages);
const { i18n } = window.SignalContext;
const createProps = (overrideProps: Partial<PropsType> = {}): PropsType => ({
avatarData:

View File

@@ -6,13 +6,11 @@ import React from 'react';
import { action } from '@storybook/addon-actions';
import type { Meta } from '@storybook/react';
import enMessages from '../../_locales/en/messages.json';
import { AvatarColors } from '../types/Colors';
import type { PropsType } from './BetterAvatarBubble';
import { BetterAvatarBubble } from './BetterAvatarBubble';
import { setupI18n } from '../util/setupI18n';
const i18n = setupI18n('en', enMessages);
const { i18n } = window.SignalContext;
const createProps = (overrideProps: Partial<PropsType> = {}): PropsType => ({
children: overrideProps.children,

View File

@@ -3,14 +3,12 @@
import React from 'react';
import { action } from '@storybook/addon-actions';
import { setupI18n } from '../util/setupI18n';
import enMessages from '../../_locales/en/messages.json';
import type { CallLinkAddNameModalProps } from './CallLinkAddNameModal';
import { CallLinkAddNameModal } from './CallLinkAddNameModal';
import type { ComponentMeta } from '../storybook/types';
import { FAKE_CALL_LINK_WITH_ADMIN_KEY } from '../test-both/helpers/fakeCallLink';
const i18n = setupI18n('en', enMessages);
const { i18n } = window.SignalContext;
export default {
title: 'Components/CallLinkAddNameModal',

View File

@@ -5,15 +5,13 @@ import { action } from '@storybook/addon-actions';
import type { ComponentMeta } from '../storybook/types';
import type { CallLinkDetailsProps } from './CallLinkDetails';
import { CallLinkDetails } from './CallLinkDetails';
import { setupI18n } from '../util/setupI18n';
import enMessages from '../../_locales/en/messages.json';
import {
FAKE_CALL_LINK,
FAKE_CALL_LINK_WITH_ADMIN_KEY,
} from '../test-both/helpers/fakeCallLink';
import { getFakeCallLinkHistoryGroup } from '../test-both/helpers/getFakeCallHistoryGroup';
const i18n = setupI18n('en', enMessages);
const { i18n } = window.SignalContext;
export default {
title: 'Components/CallLinkDetails',

View File

@@ -3,14 +3,12 @@
import React from 'react';
import { action } from '@storybook/addon-actions';
import { setupI18n } from '../util/setupI18n';
import enMessages from '../../_locales/en/messages.json';
import type { CallLinkEditModalProps } from './CallLinkEditModal';
import { CallLinkEditModal } from './CallLinkEditModal';
import type { ComponentMeta } from '../storybook/types';
import { FAKE_CALL_LINK_WITH_ADMIN_KEY } from '../test-both/helpers/fakeCallLink';
const i18n = setupI18n('en', enMessages);
const { i18n } = window.SignalContext;
export default {
title: 'Components/CallLinkEditModal',

View File

@@ -3,14 +3,12 @@
import React from 'react';
import { action } from '@storybook/addon-actions';
import { setupI18n } from '../util/setupI18n';
import enMessages from '../../_locales/en/messages.json';
import type { CallLinkPendingParticipantModalProps } from './CallLinkPendingParticipantModal';
import { CallLinkPendingParticipantModal } from './CallLinkPendingParticipantModal';
import type { ComponentMeta } from '../storybook/types';
import { getDefaultConversation } from '../test-both/helpers/getDefaultConversation';
const i18n = setupI18n('en', enMessages);
const { i18n } = window.SignalContext;
const conversation = getDefaultConversation({
acceptedMessageRequest: true,

View File

@@ -26,8 +26,6 @@ import { AvatarColors } from '../types/Colors';
import { generateAci } from '../types/ServiceId';
import { getDefaultConversation } from '../test-both/helpers/getDefaultConversation';
import { fakeGetGroupCallVideoFrameSource } from '../test-both/helpers/fakeGetGroupCallVideoFrameSource';
import { setupI18n } from '../util/setupI18n';
import enMessages from '../../_locales/en/messages.json';
import { StorySendMode } from '../types/Stories';
import {
FAKE_CALL_LINK,
@@ -37,7 +35,7 @@ import {
import { allRemoteParticipants } from './CallScreen.stories';
import { getPlaceholderContact } from '../state/selectors/conversations';
const i18n = setupI18n('en', enMessages);
const { i18n } = window.SignalContext;
const getConversation = () =>
getDefaultConversation({

View File

@@ -4,13 +4,11 @@
import React from 'react';
import { action } from '@storybook/addon-actions';
import type { ComponentMeta } from '../storybook/types';
import { setupI18n } from '../util/setupI18n';
import enMessages from '../../_locales/en/messages.json';
import type { Props } from './CallNeedPermissionScreen';
import { CallNeedPermissionScreen } from './CallNeedPermissionScreen';
import { getDefaultConversation } from '../test-both/helpers/getDefaultConversation';
const i18n = setupI18n('en', enMessages);
const { i18n } = window.SignalContext;
export default {
title: 'Components/CallNeedPermissionScreen',

View File

@@ -24,14 +24,12 @@ import { AvatarColors } from '../types/Colors';
import type { PropsType } from './CallScreen';
import { CallScreen as UnwrappedCallScreen } from './CallScreen';
import { DEFAULT_PREFERRED_REACTION_EMOJI } from '../reactions/constants';
import { setupI18n } from '../util/setupI18n';
import { missingCaseError } from '../util/missingCaseError';
import {
getDefaultConversation,
getDefaultConversationWithServiceId,
} from '../test-both/helpers/getDefaultConversation';
import { fakeGetGroupCallVideoFrameSource } from '../test-both/helpers/fakeGetGroupCallVideoFrameSource';
import enMessages from '../../_locales/en/messages.json';
import { CallingToastProvider, useCallingToasts } from './CallingToast';
import type { CallingImageDataCache } from './CallManager';
import { MINUTE } from '../util/durations';
@@ -39,7 +37,7 @@ import { MINUTE } from '../util/durations';
const MAX_PARTICIPANTS = 75;
const LOCAL_DEMUX_ID = 1;
const i18n = setupI18n('en', enMessages);
const { i18n } = window.SignalContext;
const conversation = getDefaultConversation({
id: '3051234567',

View File

@@ -12,12 +12,10 @@ import { AvatarColors } from '../types/Colors';
import type { GroupCallRemoteParticipantType } from '../types/Calling';
import { generateAci } from '../types/ServiceId';
import { getDefaultConversation } from '../test-both/helpers/getDefaultConversation';
import { setupI18n } from '../util/setupI18n';
import enMessages from '../../_locales/en/messages.json';
import type { CallLinkType } from '../types/CallLink';
import { CallLinkRestrictions } from '../types/CallLink';
const i18n = setupI18n('en', enMessages);
const { i18n } = window.SignalContext;
const OUR_ACI = generateAci();

View File

@@ -7,10 +7,8 @@ import type { Meta } from '@storybook/react';
import type { PropsType } from './CallingButton';
import { CallingButton, CallingButtonType } from './CallingButton';
import { TooltipPlacement } from './Tooltip';
import { setupI18n } from '../util/setupI18n';
import enMessages from '../../_locales/en/messages.json';
const i18n = setupI18n('en', enMessages);
const { i18n } = window.SignalContext;
export default {
title: 'Components/CallingButton',

View File

@@ -7,10 +7,8 @@ import { action } from '@storybook/addon-actions';
import type { Meta } from '@storybook/react';
import type { Props } from './CallingDeviceSelection';
import { CallingDeviceSelection } from './CallingDeviceSelection';
import { setupI18n } from '../util/setupI18n';
import enMessages from '../../_locales/en/messages.json';
const i18n = setupI18n('en', enMessages);
const { i18n } = window.SignalContext;
const audioDevice = {
name: '',

View File

@@ -6,11 +6,9 @@ import { action } from '@storybook/addon-actions';
import type { Meta } from '@storybook/react';
import type { PropsType } from './CallingHeader';
import { CallingHeader } from './CallingHeader';
import { setupI18n } from '../util/setupI18n';
import enMessages from '../../_locales/en/messages.json';
import { CallViewMode } from '../types/Calling';
const i18n = setupI18n('en', enMessages);
const { i18n } = window.SignalContext;
export default {
title: 'Components/CallingHeader',

View File

@@ -11,9 +11,7 @@ import { AvatarColors } from '../types/Colors';
import type { ConversationType } from '../state/ducks/conversations';
import type { PropsType } from './CallingLobby';
import { CallingLobby as UnwrappedCallingLobby } from './CallingLobby';
import { setupI18n } from '../util/setupI18n';
import { generateAci } from '../types/ServiceId';
import enMessages from '../../_locales/en/messages.json';
import {
getDefaultConversation,
getDefaultConversationWithServiceId,
@@ -22,7 +20,7 @@ import { CallingToastProvider } from './CallingToast';
import { CallMode } from '../types/CallDisposition';
import { getDefaultCallLinkConversation } from '../test-both/helpers/fakeCallLink';
const i18n = setupI18n('en', enMessages);
const { i18n } = window.SignalContext;
const camera = {
deviceId: 'dfbe6effe70b0611ba0fdc2a9ea3f39f6cb110e6687948f7e5f016c111b7329c',

View File

@@ -12,10 +12,8 @@ import { AvatarColors } from '../types/Colors';
import type { GroupCallRemoteParticipantType } from '../types/Calling';
import { generateAci } from '../types/ServiceId';
import { getDefaultConversationWithServiceId } from '../test-both/helpers/getDefaultConversation';
import { setupI18n } from '../util/setupI18n';
import enMessages from '../../_locales/en/messages.json';
const i18n = setupI18n('en', enMessages);
const { i18n } = window.SignalContext;
function createParticipant(
participantProps: Partial<GroupCallRemoteParticipantType>

View File

@@ -6,11 +6,9 @@ import { action } from '@storybook/addon-actions';
import type { Meta } from '@storybook/react';
import type { PropsType } from './CallingPendingParticipants';
import { CallingPendingParticipants } from './CallingPendingParticipants';
import { setupI18n } from '../util/setupI18n';
import enMessages from '../../_locales/en/messages.json';
import { allRemoteParticipants } from './CallScreen.stories';
const i18n = setupI18n('en', enMessages);
const { i18n } = window.SignalContext;
const createProps = (storyProps: Partial<PropsType> = {}): PropsType => ({
i18n,

View File

@@ -19,11 +19,9 @@ import {
import { CallMode } from '../types/CallDisposition';
import { getDefaultConversation } from '../test-both/helpers/getDefaultConversation';
import { fakeGetGroupCallVideoFrameSource } from '../test-both/helpers/fakeGetGroupCallVideoFrameSource';
import { setupI18n } from '../util/setupI18n';
import enMessages from '../../_locales/en/messages.json';
import { MINUTE } from '../util/durations';
const i18n = setupI18n('en', enMessages);
const { i18n } = window.SignalContext;
const conversation: ConversationType = getDefaultConversation({
id: '3051234567',

View File

@@ -4,8 +4,6 @@
import React from 'react';
import { times } from 'lodash';
import type { Meta } from '@storybook/react';
import { setupI18n } from '../util/setupI18n';
import enMessages from '../../_locales/en/messages.json';
import { getDefaultConversation } from '../test-both/helpers/getDefaultConversation';
import type { PropsType } from './CallingPreCallInfo';
import { CallingPreCallInfo, RingMode } from './CallingPreCallInfo';
@@ -15,7 +13,7 @@ import { generateAci } from '../types/ServiceId';
import { FAKE_CALL_LINK } from '../test-both/helpers/fakeCallLink';
import { callLinkToConversation } from '../util/callLinks';
const i18n = setupI18n('en', enMessages);
const { i18n } = window.SignalContext;
const getDefaultGroupConversation = () =>
getDefaultConversation({
name: 'Tahoe Trip',

View File

@@ -17,8 +17,6 @@ import {
import type { ConversationType } from '../state/ducks/conversations';
import { AvatarColors } from '../types/Colors';
import { getDefaultConversationWithServiceId } from '../test-both/helpers/getDefaultConversation';
import { setupI18n } from '../util/setupI18n';
import enMessages from '../../_locales/en/messages.json';
const MAX_HANDS = 20;
const LOCAL_DEMUX_ID = 1;
@@ -31,7 +29,7 @@ const NAMES = [
'Kiki',
];
const i18n = setupI18n('en', enMessages);
const { i18n } = window.SignalContext;
const conversation = getDefaultConversationWithServiceId({
id: '3051234567',

View File

@@ -8,11 +8,9 @@ import type { Meta } from '@storybook/react';
import type { PropsType } from './CallingScreenSharingController';
import { CallingScreenSharingController } from './CallingScreenSharingController';
import { setupI18n } from '../util/setupI18n';
import { ScreenShareStatus } from '../types/Calling';
import enMessages from '../../_locales/en/messages.json';
const i18n = setupI18n('en', enMessages);
const { i18n } = window.SignalContext;
const createProps = (overrideProps: Partial<PropsType> = {}): PropsType => ({
i18n,

View File

@@ -8,10 +8,7 @@ import type { Meta } from '@storybook/react';
import type { PropsType } from './CallingSelectPresentingSourcesModal';
import { CallingSelectPresentingSourcesModal } from './CallingSelectPresentingSourcesModal';
import { setupI18n } from '../util/setupI18n';
import enMessages from '../../_locales/en/messages.json';
const i18n = setupI18n('en', enMessages);
const { i18n } = window.SignalContext;
const createProps = (): PropsType => ({
i18n,

View File

@@ -7,10 +7,8 @@ import type { Meta } from '@storybook/react';
import type { PropsType } from './CaptchaDialog';
import { CaptchaDialog } from './CaptchaDialog';
import { Button } from './Button';
import { setupI18n } from '../util/setupI18n';
import enMessages from '../../_locales/en/messages.json';
const i18n = setupI18n('en', enMessages);
const { i18n } = window.SignalContext;
export default {
title: 'Components/CaptchaDialog',

View File

@@ -4,13 +4,11 @@
import React from 'react';
import { action } from '@storybook/addon-actions';
import type { Meta } from '@storybook/react';
import enMessages from '../../_locales/en/messages.json';
import type { PropsType } from './ChatColorPicker';
import { ChatColorPicker } from './ChatColorPicker';
import { ConversationColors } from '../types/Colors';
import { setupI18n } from '../util/setupI18n';
const i18n = setupI18n('en', enMessages);
const { i18n } = window.SignalContext;
export default {
title: 'Components/ChatColorPicker',

View File

@@ -3,13 +3,11 @@
import React from 'react';
import { action } from '@storybook/addon-actions';
import { setupI18n } from '../util/setupI18n';
import enMessages from '../../_locales/en/messages.json';
import type { ComponentMeta } from '../storybook/types';
import type { ChatsTabProps } from './ChatsTab';
import { ChatsTab } from './ChatsTab';
const i18n = setupI18n('en', enMessages);
const { i18n } = window.SignalContext;
export default {
title: 'Components/ChatsTab',

View File

@@ -4,12 +4,10 @@
import React from 'react';
import { action } from '@storybook/addon-actions';
import type { Meta } from '@storybook/react';
import { setupI18n } from '../util/setupI18n';
import enMessages from '../../_locales/en/messages.json';
import type { PropsType } from './ClearingData';
import { ClearingData } from './ClearingData';
const i18n = setupI18n('en', enMessages);
const { i18n } = window.SignalContext;
export default {
title: 'Components/ClearingData',

View File

@@ -5,11 +5,9 @@ import React from 'react';
import type { PropsType } from './CollidingAvatars';
import { CollidingAvatars } from './CollidingAvatars';
import { type ComponentMeta } from '../storybook/types';
import { setupI18n } from '../util/setupI18n';
import { getDefaultConversation } from '../test-both/helpers/getDefaultConversation';
import enMessages from '../../_locales/en/messages.json';
const i18n = setupI18n('en', enMessages);
const { i18n } = window.SignalContext;
const alice = getDefaultConversation();
const bob = getDefaultConversation();

View File

@@ -7,8 +7,6 @@ import type { Meta } from '@storybook/react';
import { IMAGE_JPEG } from '../types/MIME';
import type { Props } from './CompositionArea';
import { CompositionArea } from './CompositionArea';
import { setupI18n } from '../util/setupI18n';
import enMessages from '../../_locales/en/messages.json';
import { StorybookThemeContext } from '../../.storybook/StorybookThemeContext';
import { fakeDraftAttachment } from '../test-both/helpers/fakeAttachment';
@@ -18,7 +16,7 @@ import { ConversationColors } from '../types/Colors';
import { getDefaultConversation } from '../test-both/helpers/getDefaultConversation';
import { PaymentEventKind } from '../types/Payment';
const i18n = setupI18n('en', enMessages);
const { i18n } = window.SignalContext;
export default {
title: 'Components/CompositionArea',

View File

@@ -9,12 +9,10 @@ import type { Meta } from '@storybook/react';
import { getDefaultConversation } from '../test-both/helpers/getDefaultConversation';
import type { Props } from './CompositionInput';
import { CompositionInput } from './CompositionInput';
import { setupI18n } from '../util/setupI18n';
import { generateAci } from '../types/ServiceId';
import enMessages from '../../_locales/en/messages.json';
import { StorybookThemeContext } from '../../.storybook/StorybookThemeContext';
const i18n = setupI18n('en', enMessages);
const { i18n } = window.SignalContext;
export default {
title: 'Components/CompositionInput',

View File

@@ -6,10 +6,8 @@ import { action } from '@storybook/addon-actions';
import type { Meta } from '@storybook/react';
import type { Props } from './CompositionRecording';
import { CompositionRecording } from './CompositionRecording';
import { setupI18n } from '../util/setupI18n';
import enMessages from '../../_locales/en/messages.json';
const i18n = setupI18n('en', enMessages);
const { i18n } = window.SignalContext;
export default {
title: 'components/CompositionRecording',

View File

@@ -6,10 +6,8 @@ import { action } from '@storybook/addon-actions';
import type { Meta } from '@storybook/react';
import type { Props } from './CompositionRecordingDraft';
import { CompositionRecordingDraft } from './CompositionRecordingDraft';
import { setupI18n } from '../util/setupI18n';
import enMessages from '../../_locales/en/messages.json';
const i18n = setupI18n('en', enMessages);
const { i18n } = window.SignalContext;
export default {
title: 'components/CompositionRecordingDraft',

View File

@@ -5,13 +5,10 @@ import React from 'react';
import { action } from '@storybook/addon-actions';
import type { Meta } from '@storybook/react';
import { setupI18n } from '../util/setupI18n';
import enMessages from '../../_locales/en/messages.json';
import type { PropsType } from './ConfirmDiscardDialog';
import { ConfirmDiscardDialog } from './ConfirmDiscardDialog';
const i18n = setupI18n('en', enMessages);
const { i18n } = window.SignalContext;
const createProps = (): PropsType => ({
i18n,

View File

@@ -7,10 +7,8 @@ import { action } from '@storybook/addon-actions';
import type { Meta } from '@storybook/react';
import type { Props } from './ConfirmationDialog';
import { ConfirmationDialog } from './ConfirmationDialog';
import { setupI18n } from '../util/setupI18n';
import enMessages from '../../_locales/en/messages.json';
const i18n = setupI18n('en', enMessages);
const { i18n } = window.SignalContext;
export default {
title: 'Components/ConfirmationDialog',

View File

@@ -7,15 +7,13 @@ import { times } from 'lodash';
import { action } from '@storybook/addon-actions';
import type { Meta } from '@storybook/react';
import { setupI18n } from '../util/setupI18n';
import enMessages from '../../_locales/en/messages.json';
import { ContactPills } from './ContactPills';
import type { PropsType as ContactPillPropsType } from './ContactPill';
import { ContactPill } from './ContactPill';
import { gifUrl } from '../storybook/Fixtures';
import { getDefaultConversation } from '../test-both/helpers/getDefaultConversation';
const i18n = setupI18n('en', enMessages);
const { i18n } = window.SignalContext;
export default {
title: 'Components/Contact Pills',

View File

@@ -7,10 +7,8 @@ import { action } from '@storybook/addon-actions';
import type { Meta } from '@storybook/react';
import type { PropsType } from './ContextMenu';
import { ContextMenu } from './ContextMenu';
import enMessages from '../../_locales/en/messages.json';
import { setupI18n } from '../util/setupI18n';
const i18n = setupI18n('en', enMessages);
const { i18n } = window.SignalContext;
export default {
title: 'Components/ContextMenu',

View File

@@ -13,13 +13,11 @@ import type { PropsData as ConversationListItemPropsType } from './conversationL
import { MessageStatuses } from './conversationList/ConversationListItem';
import { ContactCheckboxDisabledReason } from './conversationList/ContactCheckbox';
import { getDefaultConversation } from '../test-both/helpers/getDefaultConversation';
import { setupI18n } from '../util/setupI18n';
import enMessages from '../../_locales/en/messages.json';
import { ThemeType } from '../types/Util';
import { StorybookThemeContext } from '../../.storybook/StorybookThemeContext';
import { makeFakeLookupConversationWithoutServiceId } from '../test-both/helpers/fakeLookupConversationWithoutServiceId';
const i18n = setupI18n('en', enMessages);
const { i18n } = window.SignalContext;
export default {
title: 'Components/ConversationList',

View File

@@ -5,10 +5,8 @@ import React, { useState } from 'react';
import type { PropsType } from './CountryCodeSelect';
import { CountryCodeSelect } from './CountryCodeSelect';
import { type ComponentMeta } from '../storybook/types';
import { setupI18n } from '../util/setupI18n';
import enMessages from '../../_locales/en/messages.json';
const i18n = setupI18n('en', enMessages);
const { i18n } = window.SignalContext;
type StoryPropsType = Omit<PropsType, 'value' | 'onChange'>;

View File

@@ -7,15 +7,13 @@ import { action } from '@storybook/addon-actions';
import type { Meta } from '@storybook/react';
import type { PropsType } from './CrashReportDialog';
import { CrashReportDialog } from './CrashReportDialog';
import { setupI18n } from '../util/setupI18n';
import { sleep } from '../util/sleep';
import enMessages from '../../_locales/en/messages.json';
export default {
title: 'Components/CrashReportDialog',
} satisfies Meta<PropsType>;
const i18n = setupI18n('en', enMessages);
const { i18n } = window.SignalContext;
export function Basic(): JSX.Element {
const [isPending, setIsPending] = useState(false);

View File

@@ -6,16 +6,14 @@ import React from 'react';
import { action } from '@storybook/addon-actions';
import type { Meta } from '@storybook/react';
import enMessages from '../../_locales/en/messages.json';
import type { PropsType } from './CustomColorEditor';
import { CustomColorEditor } from './CustomColorEditor';
import { setupI18n } from '../util/setupI18n';
export default {
title: 'Components/CustomColorEditor',
} satisfies Meta<PropsType>;
const i18n = setupI18n('en', enMessages);
const { i18n } = window.SignalContext;
const createProps = (): PropsType => ({
i18n,

View File

@@ -6,14 +6,11 @@ import React from 'react';
import { action } from '@storybook/addon-actions';
import type { Meta } from '@storybook/react';
import { setupI18n } from '../util/setupI18n';
import { DEFAULT_PREFERRED_REACTION_EMOJI } from '../reactions/constants';
import enMessages from '../../_locales/en/messages.json';
import type { PropsType } from './CustomizingPreferredReactionsModal';
import { CustomizingPreferredReactionsModal } from './CustomizingPreferredReactionsModal';
const i18n = setupI18n('en', enMessages);
const { i18n } = window.SignalContext;
export default {
title: 'Components/CustomizingPreferredReactionsModal',

View File

@@ -5,13 +5,11 @@ import React from 'react';
import { action } from '@storybook/addon-actions';
import type { Meta } from '@storybook/react';
import enMessages from '../../_locales/en/messages.json';
import type { PropsType } from './DebugLogWindow';
import { DebugLogWindow } from './DebugLogWindow';
import { setupI18n } from '../util/setupI18n';
import { sleep } from '../util/sleep';
const i18n = setupI18n('en', enMessages);
const { i18n } = window.SignalContext;
const createProps = (): PropsType => ({
closeWindow: action('closeWindow'),

View File

@@ -5,12 +5,10 @@ import React from 'react';
import type { Meta, StoryFn } from '@storybook/react';
import { action } from '@storybook/addon-actions';
import enMessages from '../../_locales/en/messages.json';
import { setupI18n } from '../util/setupI18n';
import DeleteMessagesModal from './DeleteMessagesModal';
import type { DeleteMessagesModalProps } from './DeleteMessagesModal';
const i18n = setupI18n('en', enMessages);
const { i18n } = window.SignalContext;
export default {
title: 'Components/DeleteMessagesModal',

View File

@@ -5,12 +5,10 @@ import * as React from 'react';
import type { Meta } from '@storybook/react';
import type { PropsType } from './DialogExpiredBuild';
import { DialogExpiredBuild } from './DialogExpiredBuild';
import { setupI18n } from '../util/setupI18n';
import enMessages from '../../_locales/en/messages.json';
import { WidthBreakpoint } from './_util';
import { FakeLeftPaneContainer } from '../test-both/helpers/FakeLeftPaneContainer';
const i18n = setupI18n('en', enMessages);
const { i18n } = window.SignalContext;
export default {
title: 'Components/DialogExpiredBuild',

View File

@@ -8,12 +8,10 @@ import type { Meta } from '@storybook/react';
import type { PropsType } from './DialogNetworkStatus';
import { DialogNetworkStatus } from './DialogNetworkStatus';
import { SocketStatus } from '../types/SocketStatus';
import { setupI18n } from '../util/setupI18n';
import enMessages from '../../_locales/en/messages.json';
import { WidthBreakpoint } from './_util';
import { FakeLeftPaneContainer } from '../test-both/helpers/FakeLeftPaneContainer';
const i18n = setupI18n('en', enMessages);
const { i18n } = window.SignalContext;
const defaultProps = {
containerWidthBreakpoint: WidthBreakpoint.Wide,

View File

@@ -6,12 +6,10 @@ import { action } from '@storybook/addon-actions';
import type { Meta } from '@storybook/react';
import type { PropsType } from './DialogRelink';
import { DialogRelink } from './DialogRelink';
import { setupI18n } from '../util/setupI18n';
import enMessages from '../../_locales/en/messages.json';
import { WidthBreakpoint } from './_util';
import { FakeLeftPaneContainer } from '../test-both/helpers/FakeLeftPaneContainer';
const i18n = setupI18n('en', enMessages);
const { i18n } = window.SignalContext;
const defaultProps = {
containerWidthBreakpoint: WidthBreakpoint.Wide,

View File

@@ -11,10 +11,7 @@ import { WidthBreakpoint } from './_util';
import { SECOND } from '../util/durations';
import { FakeLeftPaneContainer } from '../test-both/helpers/FakeLeftPaneContainer';
import { setupI18n } from '../util/setupI18n';
import enMessages from '../../_locales/en/messages.json';
const i18n = setupI18n('en', enMessages);
const { i18n } = window.SignalContext;
const defaultProps = {
containerWidthBreakpoint: WidthBreakpoint.Wide,

View File

@@ -6,16 +6,13 @@ import { action } from '@storybook/addon-actions';
import type { Meta } from '@storybook/react';
import type { PropsType } from './DisappearingTimeDialog';
import { DisappearingTimeDialog } from './DisappearingTimeDialog';
import { setupI18n } from '../util/setupI18n';
import enMessages from '../../_locales/en/messages.json';
import { EXPIRE_TIMERS } from '../test-both/util/expireTimers';
export default {
title: 'Components/DisappearingTimeDialog',
} satisfies Meta<PropsType>;
const i18n = setupI18n('en', enMessages);
const { i18n } = window.SignalContext;
export function Seconds(): JSX.Element {
return (

View File

@@ -5,15 +5,13 @@ import React, { useState } from 'react';
import type { Meta } from '@storybook/react';
import type { Props } from './DisappearingTimerSelect';
import { DisappearingTimerSelect } from './DisappearingTimerSelect';
import { setupI18n } from '../util/setupI18n';
import { DurationInSeconds } from '../util/durations';
import enMessages from '../../_locales/en/messages.json';
export default {
title: 'Components/DisappearingTimerSelect',
} satisfies Meta<Props>;
const i18n = setupI18n('en', enMessages);
const { i18n } = window.SignalContext;
type Args = {
initialValue: number;

View File

@@ -2,14 +2,12 @@
// SPDX-License-Identifier: AGPL-3.0-only
import { action } from '@storybook/addon-actions';
import * as React from 'react';
import enMessages from '../../_locales/en/messages.json';
import type { ComponentMeta } from '../storybook/types';
import { getDefaultConversation } from '../test-both/helpers/getDefaultConversation';
import { setupI18n } from '../util/setupI18n';
import type { EditNicknameAndNoteModalProps } from './EditNicknameAndNoteModal';
import { EditNicknameAndNoteModal } from './EditNicknameAndNoteModal';
const i18n = setupI18n('en', enMessages);
const { i18n } = window.SignalContext;
export default {
title: 'Components/EditNicknameAndNoteModal',

View File

@@ -5,8 +5,6 @@ import React from 'react';
import type { Meta, StoryFn } from '@storybook/react';
import { action } from '@storybook/addon-actions';
import enMessages from '../../_locales/en/messages.json';
import { setupI18n } from '../util/setupI18n';
import type { UsernameReservationType } from '../types/Username';
import type { PropsType } from './EditUsernameModalBody';
@@ -16,7 +14,7 @@ import {
UsernameReservationError,
} from '../state/ducks/usernameEnums';
const i18n = setupI18n('en', enMessages);
const { i18n } = window.SignalContext;
const DEFAULT_RESERVATION: UsernameReservationType = {
username: 'reserved.56',

View File

@@ -8,11 +8,9 @@ import type { Meta } from '@storybook/react';
import type { PropsType } from './ErrorModal';
import { ErrorModal } from './ErrorModal';
import { setupI18n } from '../util/setupI18n';
import enMessages from '../../_locales/en/messages.json';
import { ButtonVariant } from './Button';
const i18n = setupI18n('en', enMessages);
const { i18n } = window.SignalContext;
const createProps = (overrideProps: Partial<PropsType> = {}): PropsType => ({
buttonVariant: overrideProps.buttonVariant ?? undefined,

View File

@@ -4,7 +4,6 @@
import * as React from 'react';
import { action } from '@storybook/addon-actions';
import type { Meta } from '@storybook/react';
import enMessages from '../../_locales/en/messages.json';
import type { AttachmentType } from '../types/Attachment';
import type { PropsType } from './ForwardMessagesModal';
import {
@@ -13,7 +12,6 @@ import {
} from './ForwardMessagesModal';
import { IMAGE_JPEG, VIDEO_MP4, stringToMIMEType } from '../types/MIME';
import { getDefaultConversation } from '../test-both/helpers/getDefaultConversation';
import { setupI18n } from '../util/setupI18n';
import { StorybookThemeContext } from '../../.storybook/StorybookThemeContext';
import { CompositionTextArea } from './CompositionTextArea';
import type { MessageForwardDraft } from '../types/ForwardDraft';
@@ -36,7 +34,7 @@ export default {
args: {},
} satisfies Meta<PropsType>;
const i18n = setupI18n('en', enMessages);
const { i18n } = window.SignalContext;
const LONG_TITLE =
"This is a super-sweet site. And it's got some really amazing content in store for you if you just click that link. Can you click that link for me?";

View File

@@ -7,18 +7,16 @@ import { action } from '@storybook/addon-actions';
import type { Meta } from '@storybook/react';
import type { PropsType } from './GroupCallOverflowArea';
import { GroupCallOverflowArea } from './GroupCallOverflowArea';
import { setupI18n } from '../util/setupI18n';
import { getDefaultConversationWithServiceId } from '../test-both/helpers/getDefaultConversation';
import { fakeGetGroupCallVideoFrameSource } from '../test-both/helpers/fakeGetGroupCallVideoFrameSource';
import { FRAME_BUFFER_SIZE } from '../calling/constants';
import enMessages from '../../_locales/en/messages.json';
import { generateAci } from '../types/ServiceId';
import type { CallingImageDataCache } from './CallManager';
import { MINUTE } from '../util/durations';
const MAX_PARTICIPANTS = 32;
const i18n = setupI18n('en', enMessages);
const { i18n } = window.SignalContext;
const allRemoteParticipants = times(MAX_PARTICIPANTS).map(index => ({
aci: generateAci(),

View File

@@ -8,13 +8,11 @@ import type { PropsType } from './GroupCallRemoteParticipant';
import { GroupCallRemoteParticipant } from './GroupCallRemoteParticipant';
import { getDefaultConversation } from '../test-both/helpers/getDefaultConversation';
import { FRAME_BUFFER_SIZE } from '../calling/constants';
import { setupI18n } from '../util/setupI18n';
import { generateAci } from '../types/ServiceId';
import enMessages from '../../_locales/en/messages.json';
import type { CallingImageDataCache } from './CallManager';
import { MINUTE } from '../util/durations';
const i18n = setupI18n('en', enMessages);
const { i18n } = window.SignalContext;
type OverridePropsType = {
audioLevel?: number;

View File

@@ -3,12 +3,10 @@
import React, { useState } from 'react';
import type { Meta } from '@storybook/react';
import { setupI18n } from '../util/setupI18n';
import enMessages from '../../_locales/en/messages.json';
import type { PropsType } from './GroupDescriptionInput';
import { GroupDescriptionInput } from './GroupDescriptionInput';
const i18n = setupI18n('en', enMessages);
const { i18n } = window.SignalContext;
export default {
title: 'Components/GroupDescriptionInput',

View File

@@ -3,12 +3,10 @@
import React, { useState } from 'react';
import type { Meta } from '@storybook/react';
import { setupI18n } from '../util/setupI18n';
import enMessages from '../../_locales/en/messages.json';
import type { PropsType } from './GroupTitleInput';
import { GroupTitleInput } from './GroupTitleInput';
const i18n = setupI18n('en', enMessages);
const { i18n } = window.SignalContext;
export default {
title: 'Components/GroupTitleInput',

View File

@@ -9,12 +9,10 @@ import type { Meta } from '@storybook/react';
import type { PropsType } from './GroupV1MigrationDialog';
import { GroupV1MigrationDialog } from './GroupV1MigrationDialog';
import type { ConversationType } from '../state/ducks/conversations';
import { setupI18n } from '../util/setupI18n';
import enMessages from '../../_locales/en/messages.json';
import { getDefaultConversation } from '../test-both/helpers/getDefaultConversation';
import { ThemeType } from '../types/Util';
const i18n = setupI18n('en', enMessages);
const { i18n } = window.SignalContext;
const contact1: ConversationType = getDefaultConversation({
title: 'Alice',

View File

@@ -6,10 +6,8 @@ import { action } from '@storybook/addon-actions';
import type { Meta } from '@storybook/react';
import type { PropsType } from './GroupV2JoinDialog';
import { GroupV2JoinDialog } from './GroupV2JoinDialog';
import { setupI18n } from '../util/setupI18n';
import enMessages from '../../_locales/en/messages.json';
const i18n = setupI18n('en', enMessages);
const { i18n } = window.SignalContext;
const createProps = (overrideProps: Partial<PropsType> = {}): PropsType => ({
memberCount: overrideProps.memberCount ?? 12,

View File

@@ -6,10 +6,8 @@ import * as React from 'react';
import type { ComponentMeta } from '../storybook/types';
import type { Props } from './I18n';
import { I18n } from './I18n';
import { setupI18n } from '../util/setupI18n';
import enMessages from '../../_locales/en/messages.json';
const i18n = setupI18n('en', enMessages);
const { i18n } = window.SignalContext;
export default {
title: 'Components/I18n',

View File

@@ -3,12 +3,10 @@
import * as React from 'react';
import type { Meta } from '@storybook/react';
import { setupI18n } from '../util/setupI18n';
import enMessages from '../../_locales/en/messages.json';
import type { PropsType } from './InContactsIcon';
import { InContactsIcon } from './InContactsIcon';
const i18n = setupI18n('en', enMessages);
const { i18n } = window.SignalContext;
export default {
title: 'Components/InContactsIcon',

View File

@@ -9,10 +9,7 @@ import { Inbox } from './Inbox';
import type { PropsType } from './Inbox';
import { DAY, SECOND } from '../util/durations';
import { setupI18n } from '../util/setupI18n';
import enMessages from '../../_locales/en/messages.json';
const i18n = setupI18n('en', enMessages);
const { i18n } = window.SignalContext;
export default {
title: 'Components/Inbox',

View File

@@ -7,11 +7,9 @@ import type { Meta } from '@storybook/react';
import type { PropsType } from './IncomingCallBar';
import { IncomingCallBar } from './IncomingCallBar';
import { CallMode } from '../types/CallDisposition';
import { setupI18n } from '../util/setupI18n';
import enMessages from '../../_locales/en/messages.json';
import { getDefaultConversation } from '../test-both/helpers/getDefaultConversation';
const i18n = setupI18n('en', enMessages);
const { i18n } = window.SignalContext;
const commonProps = {
acceptCall: action('accept-call'),

View File

@@ -6,10 +6,8 @@ import { action } from '@storybook/addon-actions';
import type { Meta } from '@storybook/react';
import type { PropsType } from './Input';
import { Input } from './Input';
import { setupI18n } from '../util/setupI18n';
import enMessages from '../../_locales/en/messages.json';
const i18n = setupI18n('en', enMessages);
const { i18n } = window.SignalContext;
export default {
title: 'Components/Input',

View File

@@ -18,9 +18,7 @@ import { DialogUpdate } from './DialogUpdate';
import { UnsupportedOSDialog } from './UnsupportedOSDialog';
import type { ConversationType } from '../state/ducks/conversations';
import { MessageSearchResult } from './conversationList/MessageSearchResult';
import { setupI18n } from '../util/setupI18n';
import { DurationInSeconds, DAY } from '../util/durations';
import enMessages from '../../_locales/en/messages.json';
import { LeftPaneMode } from '../types/leftPane';
import { ThemeType } from '../types/Util';
import {
@@ -37,7 +35,7 @@ import {
import type { GroupListItemConversationType } from './conversationList/GroupListItem';
import { CriticalIdlePrimaryDeviceDialog } from './CriticalIdlePrimaryDeviceDialog';
const i18n = setupI18n('en', enMessages);
const { i18n } = window.SignalContext;
type OverridePropsType = Partial<PropsType> & {
dialogNetworkStatus?: Partial<DialogNetworkStatusPropsType>;

View File

@@ -5,11 +5,9 @@ import React, { useState } from 'react';
import { action } from '@storybook/addon-actions';
import { noop } from 'lodash';
import type { Meta } from '@storybook/react';
import enMessages from '../../_locales/en/messages.json';
import type { PropsType } from './Lightbox';
import { Lightbox } from './Lightbox';
import type { MediaItemType } from '../types/MediaItem';
import { setupI18n } from '../util/setupI18n';
import {
AUDIO_MP3,
IMAGE_JPEG,
@@ -20,7 +18,7 @@ import {
import { fakeAttachment } from '../test-both/helpers/fakeAttachment';
const i18n = setupI18n('en', enMessages);
const { i18n } = window.SignalContext;
export default {
title: 'Components/Lightbox',

View File

@@ -6,11 +6,9 @@ import React from 'react';
import { action } from '@storybook/addon-actions';
import type { PropsType } from './LocalDeleteWarningModal';
import enMessages from '../../_locales/en/messages.json';
import { LocalDeleteWarningModal } from './LocalDeleteWarningModal';
import { setupI18n } from '../util/setupI18n';
const i18n = setupI18n('en', enMessages);
const { i18n } = window.SignalContext;
export default {
title: 'Components/LocalDeleteWarningModal',

View File

@@ -7,11 +7,9 @@ import React from 'react';
import { action } from '@storybook/addon-actions';
import type { PropsType } from './MediaEditor';
import { MediaEditor } from './MediaEditor';
import enMessages from '../../_locales/en/messages.json';
import { setupI18n } from '../util/setupI18n';
import { Stickers, installedPacks } from '../test-both/helpers/getStickerPacks';
const i18n = setupI18n('en', enMessages);
const { i18n } = window.SignalContext;
const IMAGE_1 = '/fixtures/nathan-anderson-316188-unsplash.jpg';
const IMAGE_2 = '/fixtures/tina-rolf-269345-unsplash.jpg';
const IMAGE_3 = '/fixtures/kitten-4-112-112.jpg';

View File

@@ -2,13 +2,11 @@
// SPDX-License-Identifier: AGPL-3.0-only
import React, { StrictMode } from 'react';
import { action } from '@storybook/addon-actions';
import enMessages from '../../_locales/en/messages.json';
import { type ComponentMeta } from '../storybook/types';
import { setupI18n } from '../util/setupI18n';
import type { PropsType } from './MediaPermissionsModal';
import { MediaPermissionsModal } from './MediaPermissionsModal';
const i18n = setupI18n('en', enMessages);
const { i18n } = window.SignalContext;
type TemplateProps = Omit<PropsType, 'i18n' | 'children'>;

View File

@@ -4,10 +4,8 @@
import React from 'react';
import { action } from '@storybook/addon-actions';
import type { Meta } from '@storybook/react';
import enMessages from '../../_locales/en/messages.json';
import type { PropsType } from './MediaQualitySelector';
import { MediaQualitySelector } from './MediaQualitySelector';
import { setupI18n } from '../util/setupI18n';
export default {
title: 'Components/MediaQualitySelector',
@@ -15,7 +13,7 @@ export default {
args: {},
} satisfies Meta<PropsType>;
const i18n = setupI18n('en', enMessages);
const { i18n } = window.SignalContext;
const createProps = (overrideProps: Partial<PropsType> = {}): PropsType => ({
conversationId: 'abc123',

View File

@@ -6,10 +6,7 @@ import type { Meta } from '@storybook/react';
import type { Props } from './MiniPlayer';
import { MiniPlayer, PlayerState } from './MiniPlayer';
import { setupI18n } from '../util/setupI18n';
import enMessages from '../../_locales/en/messages.json';
const i18n = setupI18n('en', enMessages);
const { i18n } = window.SignalContext;
const audio = new Audio();
audio.src = '/fixtures/incompetech-com-Agnus-Dei-X.mp3';

View File

@@ -5,13 +5,11 @@ import React from 'react';
import { noop } from 'lodash';
import { action } from '@storybook/addon-actions';
import type { Meta } from '@storybook/react';
import { setupI18n } from '../util/setupI18n';
import enMessages from '../../_locales/en/messages.json';
import { Button } from './Button';
import type { ModalPropsType } from './Modal';
import { Modal } from './Modal';
const i18n = setupI18n('en', enMessages);
const { i18n } = window.SignalContext;
export default {
title: 'Components/Modal',

View File

@@ -9,16 +9,14 @@ import { expect, fn, within, userEvent } from '@storybook/test';
import { action } from '@storybook/addon-actions';
import type { PropsType } from './MyStories';
import enMessages from '../../_locales/en/messages.json';
import { MY_STORY_ID } from '../types/Stories';
import { MyStories } from './MyStories';
import { SendStatus } from '../messages/MessageSendState';
import { getDefaultConversation } from '../test-both/helpers/getDefaultConversation';
import { getFakeMyStory } from '../test-both/helpers/getFakeStory';
import { setupI18n } from '../util/setupI18n';
import { sleep } from '../util/sleep';
const i18n = setupI18n('en', enMessages);
const { i18n } = window.SignalContext;
export default {
title: 'Components/MyStories',

View File

@@ -8,15 +8,13 @@ import { expect, fn, within, userEvent } from '@storybook/test';
import { action } from '@storybook/addon-actions';
import type { PropsType } from './MyStoryButton';
import enMessages from '../../_locales/en/messages.json';
import { MyStoryButton } from './MyStoryButton';
import { getDefaultConversation } from '../test-both/helpers/getDefaultConversation';
import { getFakeMyStory } from '../test-both/helpers/getFakeStory';
import { setupI18n } from '../util/setupI18n';
import { SendStatus } from '../messages/MessageSendState';
import { ResolvedSendStatus } from '../types/Stories';
const i18n = setupI18n('en', enMessages);
const { i18n } = window.SignalContext;
export default {
title: 'Components/MyStoriesButton',

View File

@@ -8,13 +8,11 @@ import { action } from '@storybook/addon-actions';
import type { Meta } from '@storybook/react';
import type { PropsType } from './NewlyCreatedGroupInvitedContactsDialog';
import { NewlyCreatedGroupInvitedContactsDialog } from './NewlyCreatedGroupInvitedContactsDialog';
import { setupI18n } from '../util/setupI18n';
import enMessages from '../../_locales/en/messages.json';
import type { ConversationType } from '../state/ducks/conversations';
import { getDefaultConversation } from '../test-both/helpers/getDefaultConversation';
import { ThemeType } from '../types/Util';
const i18n = setupI18n('en', enMessages);
const { i18n } = window.SignalContext;
const conversations: Array<ConversationType> = [
getDefaultConversation({ title: 'Fred Willard' }),

View File

@@ -2,16 +2,14 @@
// SPDX-License-Identifier: AGPL-3.0-only
import { action } from '@storybook/addon-actions';
import * as React from 'react';
import enMessages from '../../_locales/en/messages.json';
import type { ComponentMeta } from '../storybook/types';
import { getDefaultConversation } from '../test-both/helpers/getDefaultConversation';
import { setupI18n } from '../util/setupI18n';
import {
NotePreviewModal,
type NotePreviewModalProps,
} from './NotePreviewModal';
const i18n = setupI18n('en', enMessages);
const { i18n } = window.SignalContext;
export default {
title: 'Components/NotePreviewModal',

View File

@@ -6,11 +6,9 @@ import { action } from '@storybook/addon-actions';
import type { Meta } from '@storybook/react';
import type { PropsType } from './OutgoingGiftBadgeModal';
import { OutgoingGiftBadgeModal } from './OutgoingGiftBadgeModal';
import { setupI18n } from '../util/setupI18n';
import enMessages from '../../_locales/en/messages.json';
import { BadgeCategory } from '../badges/BadgeCategory';
const i18n = setupI18n('en', enMessages);
const { i18n } = window.SignalContext;
const getPreferredBadge = () => ({
category: BadgeCategory.Donor,

View File

@@ -5,16 +5,14 @@ import type { Meta, StoryFn } from '@storybook/react';
import React from 'react';
import { action } from '@storybook/addon-actions';
import enMessages from '../../_locales/en/messages.json';
import type { PropsType } from './Preferences';
import { Preferences } from './Preferences';
import { setupI18n } from '../util/setupI18n';
import { DEFAULT_CONVERSATION_COLOR } from '../types/Colors';
import { PhoneNumberSharingMode } from '../util/phoneNumberSharingMode';
import { PhoneNumberDiscoverability } from '../util/phoneNumberDiscoverability';
import { DurationInSeconds } from '../util/durations';
const i18n = setupI18n('en', enMessages);
const { i18n } = window.SignalContext;
const availableMicrophones = [
{

View File

@@ -8,7 +8,6 @@ import casual from 'casual';
import { v4 as generateUuid } from 'uuid';
import type { PropsType } from './ProfileEditor';
import enMessages from '../../_locales/en/messages.json';
import { ProfileEditor } from './ProfileEditor';
import { EditUsernameModalBody } from './EditUsernameModalBody';
import {
@@ -17,10 +16,9 @@ import {
UsernameReservationState,
} from '../state/ducks/usernameEnums';
import { getRandomColor } from '../test-both/helpers/getRandomColor';
import { setupI18n } from '../util/setupI18n';
import { SignalService as Proto } from '../protobuf';
const i18n = setupI18n('en', enMessages);
const { i18n } = window.SignalContext;
export default {
component: ProfileEditor,

View File

@@ -6,15 +6,12 @@ import * as React from 'react';
import type { Meta } from '@storybook/react';
import type { PropsType } from './ProgressDialog';
import { ProgressDialog } from './ProgressDialog';
import { setupI18n } from '../util/setupI18n';
import enMessages from '../../_locales/en/messages.json';
export default {
title: 'Components/ProgressDialog',
} satisfies Meta<PropsType>;
const i18n = setupI18n('en', enMessages);
const { i18n } = window.SignalContext;
const createProps = (): PropsType => ({
i18n,

Some files were not shown because too many files have changed in this diff Show More