-
Notifications
You must be signed in to change notification settings - Fork 703
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
23 changed files
with
401 additions
and
279 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
79 changes: 25 additions & 54 deletions
79
app/components-react/windows/go-live/platforms/KickEditStreamInfo.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,65 +1,36 @@ | ||
import React from 'react'; | ||
import { $t } from 'services/i18n'; | ||
import { CommonPlatformFields } from '../CommonPlatformFields'; | ||
import Form from '../../../shared/inputs/Form'; | ||
import { createBinding } from '../../../shared/inputs'; | ||
import { IPlatformComponentParams } from './PlatformSettingsLayout'; | ||
import { clipboard } from 'electron'; | ||
import { TextInput } from 'components-react/shared/inputs'; | ||
import { Alert, Button } from 'antd'; | ||
import { createBinding, InputComponent } from '../../../shared/inputs'; | ||
import PlatformSettingsLayout, { IPlatformComponentParams } from './PlatformSettingsLayout'; | ||
import { IKickStartStreamOptions } from '../../../../services/platforms/kick'; | ||
|
||
/** | ||
* Note: The implementation for this component is a light refactor of the InstagramEditStreamInfo component. | ||
/*** | ||
* Stream Settings for Kick | ||
*/ | ||
export const KickEditStreamInfo = InputComponent((p: IPlatformComponentParams<'kick'>) => { | ||
function updateSettings(patch: Partial<IKickStartStreamOptions>) { | ||
p.onChange({ ...kickSettings, ...patch }); | ||
} | ||
|
||
type Props = IPlatformComponentParams<'kick'> & { | ||
isStreamSettingsWindow?: boolean; | ||
}; | ||
|
||
export function KickEditStreamInfo(p: Props) { | ||
const bind = createBinding(p.value, updatedSettings => | ||
p.onChange({ ...p.value, ...updatedSettings }), | ||
); | ||
|
||
const { isStreamSettingsWindow } = p; | ||
const streamKeyLabel = $t(isStreamSettingsWindow ? 'Stream Key' : 'Kick Stream Key'); | ||
const streamUrlLabel = $t(isStreamSettingsWindow ? 'Stream URL' : 'Kick Stream URL'); | ||
const kickSettings = p.value; | ||
const bind = createBinding(kickSettings, newKickSettings => updateSettings(newKickSettings)); | ||
|
||
return ( | ||
<Form name="kick-settings"> | ||
<TextInput | ||
{...bind.streamUrl} | ||
required | ||
label={streamUrlLabel} | ||
addonAfter={<PasteButton onPaste={bind.streamUrl.onChange} />} | ||
/> | ||
|
||
<TextInput | ||
{...bind.streamKey} | ||
required | ||
label={streamKeyLabel} | ||
isPassword | ||
placeholder={$t('Remember to update your Stream Key')} | ||
addonAfter={<PasteButton onPaste={bind.streamKey.onChange} />} | ||
<PlatformSettingsLayout | ||
layoutMode={p.layoutMode} | ||
commonFields={ | ||
<CommonPlatformFields | ||
key="common" | ||
platform="kick" | ||
layoutMode={p.layoutMode} | ||
value={kickSettings} | ||
onChange={updateSettings} | ||
/> | ||
} | ||
requiredFields={<div key={'empty-kick'} />} | ||
/> | ||
{!isStreamSettingsWindow && ( | ||
<Alert | ||
style={{ marginBottom: 8 }} | ||
message={$t( | ||
'Remember to open Kick in browser and enter your Stream URL and Key to start streaming!', | ||
)} | ||
type="warning" | ||
showIcon | ||
closable | ||
/> | ||
)} | ||
</Form> | ||
); | ||
} | ||
|
||
function PasteButton({ onPaste }: { onPaste: (text: string) => void }) { | ||
return ( | ||
<Button title={$t('Paste')} onClick={() => onPaste(clipboard.readText())}> | ||
<i className="fa fa-paste" /> | ||
</Button> | ||
); | ||
} | ||
}); |
Oops, something went wrong.