Fix storybook for calling sources modal
This commit is contained in:
parent
4416715bff
commit
5b18bb8563
4 changed files with 18 additions and 18 deletions
|
@ -21,29 +21,34 @@ const createProps = (): PropsType => ({
|
||||||
{
|
{
|
||||||
id: 'screen',
|
id: 'screen',
|
||||||
name: 'Entire Screen',
|
name: 'Entire Screen',
|
||||||
|
isScreen: true,
|
||||||
thumbnail:
|
thumbnail:
|
||||||
'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+P/1PwAF8AL1sEVIPAAAAABJRU5ErkJggg==',
|
'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+P/1PwAF8AL1sEVIPAAAAABJRU5ErkJggg==',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 'window:123',
|
id: 'window:123',
|
||||||
name: 'Bozirro Airhorse',
|
name: 'Bozirro Airhorse',
|
||||||
|
isScreen: false,
|
||||||
thumbnail:
|
thumbnail:
|
||||||
'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mP8z1D4HwAF5wJxzsNOIAAAAABJRU5ErkJggg==',
|
'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mP8z1D4HwAF5wJxzsNOIAAAAABJRU5ErkJggg==',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 'window:456',
|
id: 'window:456',
|
||||||
name: 'Discoverer',
|
name: 'Discoverer',
|
||||||
|
isScreen: false,
|
||||||
thumbnail:
|
thumbnail:
|
||||||
'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mP8z8HwHwAFHQIIj4yLtgAAAABJRU5ErkJggg==',
|
'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mP8z8HwHwAFHQIIj4yLtgAAAABJRU5ErkJggg==',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 'window:789',
|
id: 'window:789',
|
||||||
name: 'Signal Beta',
|
name: 'Signal Beta',
|
||||||
|
isScreen: false,
|
||||||
thumbnail: '',
|
thumbnail: '',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 'window:xyz',
|
id: 'window:xyz',
|
||||||
name: 'Window that has a really long name and overflows',
|
name: 'Window that has a really long name and overflows',
|
||||||
|
isScreen: false,
|
||||||
thumbnail:
|
thumbnail:
|
||||||
'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+O/wHwAEhgJAyqFnAgAAAABJRU5ErkJggg==',
|
'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+O/wHwAEhgJAyqFnAgAAAABJRU5ErkJggg==',
|
||||||
},
|
},
|
||||||
|
|
|
@ -9,7 +9,6 @@ import { LocalizerType } from '../types/Util';
|
||||||
import { Modal } from './Modal';
|
import { Modal } from './Modal';
|
||||||
import { PresentedSource, PresentableSource } from '../types/Calling';
|
import { PresentedSource, PresentableSource } from '../types/Calling';
|
||||||
import { Theme } from '../util/theme';
|
import { Theme } from '../util/theme';
|
||||||
import { isScreenSource, translateSourceName } from '../services/calling';
|
|
||||||
|
|
||||||
export type PropsType = {
|
export type PropsType = {
|
||||||
i18n: LocalizerType;
|
i18n: LocalizerType;
|
||||||
|
@ -18,18 +17,14 @@ export type PropsType = {
|
||||||
};
|
};
|
||||||
|
|
||||||
const Source = ({
|
const Source = ({
|
||||||
i18n,
|
|
||||||
onSourceClick,
|
onSourceClick,
|
||||||
source,
|
source,
|
||||||
sourceToPresent,
|
sourceToPresent,
|
||||||
}: {
|
}: {
|
||||||
i18n: LocalizerType;
|
|
||||||
onSourceClick: (source: PresentedSource) => void;
|
onSourceClick: (source: PresentedSource) => void;
|
||||||
source: PresentableSource;
|
source: PresentableSource;
|
||||||
sourceToPresent?: PresentedSource;
|
sourceToPresent?: PresentedSource;
|
||||||
}): JSX.Element => {
|
}): JSX.Element => {
|
||||||
const name = translateSourceName(i18n, source);
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<button
|
<button
|
||||||
className={classNames({
|
className={classNames({
|
||||||
|
@ -47,14 +42,14 @@ const Source = ({
|
||||||
type="button"
|
type="button"
|
||||||
>
|
>
|
||||||
<img
|
<img
|
||||||
alt={name}
|
alt={source.name}
|
||||||
className="module-CallingSelectPresentingSourcesModal__name--screenshot"
|
className="module-CallingSelectPresentingSourcesModal__name--screenshot"
|
||||||
src={source.thumbnail}
|
src={source.thumbnail}
|
||||||
/>
|
/>
|
||||||
<div className="module-CallingSelectPresentingSourcesModal__name--container">
|
<div className="module-CallingSelectPresentingSourcesModal__name--container">
|
||||||
{source.appIcon ? (
|
{source.appIcon ? (
|
||||||
<img
|
<img
|
||||||
alt={name}
|
alt={source.name}
|
||||||
className="module-CallingSelectPresentingSourcesModal__name--icon"
|
className="module-CallingSelectPresentingSourcesModal__name--icon"
|
||||||
height={16}
|
height={16}
|
||||||
src={source.appIcon}
|
src={source.appIcon}
|
||||||
|
@ -62,7 +57,7 @@ const Source = ({
|
||||||
/>
|
/>
|
||||||
) : null}
|
) : null}
|
||||||
<span className="module-CallingSelectPresentingSourcesModal__name--text">
|
<span className="module-CallingSelectPresentingSourcesModal__name--text">
|
||||||
{name}
|
{source.name}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</button>
|
</button>
|
||||||
|
@ -82,7 +77,10 @@ export const CallingSelectPresentingSourcesModal = ({
|
||||||
throw new Error('No sources available for presenting');
|
throw new Error('No sources available for presenting');
|
||||||
}
|
}
|
||||||
|
|
||||||
const sources = groupBy(presentingSourcesAvailable, isScreenSource);
|
const sources = groupBy(
|
||||||
|
presentingSourcesAvailable,
|
||||||
|
source => source.isScreen
|
||||||
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Modal
|
<Modal
|
||||||
|
@ -101,7 +99,6 @@ export const CallingSelectPresentingSourcesModal = ({
|
||||||
<div className="module-CallingSelectPresentingSourcesModal__sources">
|
<div className="module-CallingSelectPresentingSourcesModal__sources">
|
||||||
{sources.true.map(source => (
|
{sources.true.map(source => (
|
||||||
<Source
|
<Source
|
||||||
i18n={i18n}
|
|
||||||
key={source.id}
|
key={source.id}
|
||||||
onSourceClick={selectedSource => setSourceToPresent(selectedSource)}
|
onSourceClick={selectedSource => setSourceToPresent(selectedSource)}
|
||||||
source={source}
|
source={source}
|
||||||
|
@ -115,7 +112,6 @@ export const CallingSelectPresentingSourcesModal = ({
|
||||||
<div className="module-CallingSelectPresentingSourcesModal__sources">
|
<div className="module-CallingSelectPresentingSourcesModal__sources">
|
||||||
{sources.false.map(source => (
|
{sources.false.map(source => (
|
||||||
<Source
|
<Source
|
||||||
i18n={i18n}
|
|
||||||
key={source.id}
|
key={source.id}
|
||||||
onSourceClick={selectedSource => setSourceToPresent(selectedSource)}
|
onSourceClick={selectedSource => setSourceToPresent(selectedSource)}
|
||||||
source={source}
|
source={source}
|
||||||
|
|
|
@ -90,11 +90,11 @@ enum GroupCallUpdateMessageState {
|
||||||
SentLeft,
|
SentLeft,
|
||||||
}
|
}
|
||||||
|
|
||||||
export function isScreenSource(source: PresentedSource): boolean {
|
function isScreenSource(source: PresentedSource): boolean {
|
||||||
return source.id.startsWith('screen');
|
return source.id.startsWith('screen');
|
||||||
}
|
}
|
||||||
|
|
||||||
export function translateSourceName(
|
function translateSourceName(
|
||||||
i18n: LocalizerType,
|
i18n: LocalizerType,
|
||||||
source: PresentedSource
|
source: PresentedSource
|
||||||
): string {
|
): string {
|
||||||
|
@ -940,7 +940,8 @@ export class CallingClass {
|
||||||
? source.appIcon.toDataURL()
|
? source.appIcon.toDataURL()
|
||||||
: undefined,
|
: undefined,
|
||||||
id: source.id,
|
id: source.id,
|
||||||
name: source.name,
|
name: translateSourceName(window.i18n, source),
|
||||||
|
isScreen: isScreenSource(source),
|
||||||
thumbnail: source.thumbnail.toDataURL(),
|
thumbnail: source.thumbnail.toDataURL(),
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -982,10 +983,7 @@ export class CallingClass {
|
||||||
this.setOutgoingVideoIsScreenShare(call, isPresenting);
|
this.setOutgoingVideoIsScreenShare(call, isPresenting);
|
||||||
|
|
||||||
if (source) {
|
if (source) {
|
||||||
ipcRenderer.send(
|
ipcRenderer.send('show-screen-share', source.name);
|
||||||
'show-screen-share',
|
|
||||||
translateSourceName(window.i18n, source)
|
|
||||||
);
|
|
||||||
notify({
|
notify({
|
||||||
icon: 'images/icons/v2/video-solid-24.svg',
|
icon: 'images/icons/v2/video-solid-24.svg',
|
||||||
message: window.i18n('calling__presenting--notification-body'),
|
message: window.i18n('calling__presenting--notification-body'),
|
||||||
|
|
|
@ -14,6 +14,7 @@ export type PresentableSource = {
|
||||||
appIcon?: string;
|
appIcon?: string;
|
||||||
id: string;
|
id: string;
|
||||||
name: string;
|
name: string;
|
||||||
|
isScreen: boolean;
|
||||||
thumbnail: string;
|
thumbnail: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue