Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions apps/web/src/Login.ts
Original file line number Diff line number Diff line change
Expand Up @@ -159,10 +159,10 @@ export default class Login {
// address: username,
// };
// } else {
const identifier = {
type: "m.id.user",
user: username,
};
const identifier = {
type: "m.id.user",
user: username,
};
// }

const loginParams = {
Expand Down
28 changes: 17 additions & 11 deletions apps/web/src/components/structures/HomePage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -119,21 +119,27 @@ const HomePage: React.FC<IProps> = ({ justRegistered = false }) => {
<AutoHideScrollbar className="mx_AutoHideScrollbar mx_HomePage mx_HomePage_default" as="main">
<div className="mx_HomePage_default_wrapper">
{introSection}
<div className={classNames("mx_HomePage_default_buttons", {
"mx_HomePage_default_buttons_single": !isAdmin,
})}>
{isAdmin &&(<AccessibleButton onClick={onClickSendDm} className="mx_HomePage_button_sendDm">
<ChatSolidIcon />
{_tDom("onboarding|send_dm")}
</AccessibleButton>)}
<div
className={classNames("mx_HomePage_default_buttons", {
mx_HomePage_default_buttons_single: !isAdmin,
})}
>
{isAdmin && (
<AccessibleButton onClick={onClickSendDm} className="mx_HomePage_button_sendDm">
<ChatSolidIcon />
{_tDom("onboarding|send_dm")}
</AccessibleButton>
)}
<AccessibleButton onClick={onClickExplore} className="mx_HomePage_button_explore">
<ExploreIcon />
{_tDom("onboarding|explore_rooms")}
</AccessibleButton>
{isAdmin &&(<AccessibleButton onClick={onClickNewRoom} className="mx_HomePage_button_createGroup">
<GroupIcon />
{_tDom("onboarding|create_room")}
</AccessibleButton>)}
{isAdmin && (
<AccessibleButton onClick={onClickNewRoom} className="mx_HomePage_button_createGroup">
<GroupIcon />
{_tDom("onboarding|create_room")}
</AccessibleButton>
)}
</div>
</div>
</AutoHideScrollbar>
Expand Down
116 changes: 56 additions & 60 deletions apps/web/src/components/structures/RoomView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -992,7 +992,7 @@ export class RoomView extends React.Component<IRoomProps, IRoomState> {
this.context.client.on(CryptoEvent.KeysChanged, this.onCrossSigningKeysChanged);
this.context.client.on(MatrixEventEvent.Decrypted, this.onEventDecrypted);
}

// Start listening for RoomViewStore updates
this.roomViewStore.on(UPDATE_EVENT, this.onRoomViewStoreUpdate);

Expand Down Expand Up @@ -1048,20 +1048,20 @@ export class RoomView extends React.Component<IRoomProps, IRoomState> {
}

private loadRoomFeatures = async (): Promise<void> => {
const roomId = this.state.room?.roomId;
if (!roomId) return;
try {
const features = await getRoomFeatures(roomId);
this.setState({
vodsEnabled: !!features["vods"],
eventsEnabled: !!features["events"],
liveEnabled: !!features["live"],
});
} catch {
this.setState({ vodsEnabled: false, eventsEnabled: false });
this.setState({ vodsEnabled: false, eventsEnabled: false, liveEnabled: false });
}
};
const roomId = this.state.room?.roomId;
if (!roomId) return;
try {
const features = await getRoomFeatures(roomId);
this.setState({
vodsEnabled: !!features["vods"],
eventsEnabled: !!features["events"],
liveEnabled: !!features["live"],
});
} catch {
this.setState({ vodsEnabled: false, eventsEnabled: false });
this.setState({ vodsEnabled: false, eventsEnabled: false, liveEnabled: false });
}
};

public shouldComponentUpdate(nextProps: IRoomProps, nextState: IRoomState): boolean {
const hasPropsDiff = objectHasDiff(this.props, nextProps);
Expand Down Expand Up @@ -2713,9 +2713,7 @@ export class RoomView extends React.Component<IRoomProps, IRoomState> {
{statusBarArea}
{previewBar}
{messageComposer}
{anyDrawerFeature && (
<div style={{ height: `${PEEK_HEIGHT}px`, flexShrink: 0 }} />
)}
{anyDrawerFeature && <div style={{ height: `${PEEK_HEIGHT}px`, flexShrink: 0 }} />}
{anyDrawerFeature && (
<VodsDrawer
roomId={this.state.room.roomId}
Expand Down Expand Up @@ -2778,51 +2776,49 @@ export class RoomView extends React.Component<IRoomProps, IRoomState> {

return (
<>
<ScopedRoomContextProvider {...this.state} roomViewStore={this.roomViewStore}>
<div
className={mainClasses}
ref={this.roomView}
onKeyDown={this.onReactKeyDown}
onFocus={this.onFocus}
tabIndex={-1}
>
{showChatEffects && this.roomView.current && (
<EffectsOverlay roomWidth={this.roomView.current.offsetWidth} />
)}
<ErrorBoundary>
<MainSplit
panel={rightPanel}
sizeKey={sizeKey}
defaultSize={defaultSize}
analyticsRoomType={analyticsRoomType}
>
<div
className={mainSplitContentClasses}
ref={this.roomViewBody}
data-layout={this.state.layout}
<ScopedRoomContextProvider {...this.state} roomViewStore={this.roomViewStore}>
<div
className={mainClasses}
ref={this.roomView}
onKeyDown={this.onReactKeyDown}
onFocus={this.onFocus}
tabIndex={-1}
>
{showChatEffects && this.roomView.current && (
<EffectsOverlay roomWidth={this.roomView.current.offsetWidth} />
)}
<ErrorBoundary>
<MainSplit
panel={rightPanel}
sizeKey={sizeKey}
defaultSize={defaultSize}
analyticsRoomType={analyticsRoomType}
>
{!this.props.hideHeader && (
<RoomHeader
room={this.state.room}
legacyAdditionalButtons={this.state.viewRoomOpts.buttons}
extraButtons={<>{extraButtons}</>}
/>
)}
{mainSplitBody}
</div>
</MainSplit>
</ErrorBoundary>
</div>
</ScopedRoomContextProvider>
{this.state.liveEnabled && this.state.room && (
<div
className={mainSplitContentClasses}
ref={this.roomViewBody}
data-layout={this.state.layout}
>
{!this.props.hideHeader && (
<RoomHeader
room={this.state.room}
legacyAdditionalButtons={this.state.viewRoomOpts.buttons}
extraButtons={<>{extraButtons}</>}
/>
)}
{mainSplitBody}
</div>
</MainSplit>
</ErrorBoundary>
</div>
</ScopedRoomContextProvider>
{this.state.liveEnabled && this.state.room && (
<LiveStreamWidget
room={this.state.room}
canManage={
this.state.room.currentState.maySendStateEvent(
"im.vector.modular.widgets",
MatrixClientPeg.safeGet().getUserId() ?? "",
)
}
canManage={this.state.room.currentState.maySendStateEvent(
"im.vector.modular.widgets",
MatrixClientPeg.safeGet().getUserId() ?? "",
)}
/>
)}
</>
Expand Down
61 changes: 21 additions & 40 deletions apps/web/src/components/views/dialogs/CreateRoomDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ interface IState {
*/
canChangeEncryption: boolean;
// módulo do synapse create room
useModuleCreation : true;
useModuleCreation: true;
keyword: string;
visible: boolean;
price: string;
Expand Down Expand Up @@ -186,10 +186,7 @@ export default class CreateRoomDialog extends React.Component<IProps, IState> {
opts.useModuleCreation = true;
opts.keyword = this.state.keyword;
opts.visible = this.state.visible;
opts.access_type =
this.state.joinRule === JoinRule.Public
? "public"
: "private";
opts.access_type = this.state.joinRule === JoinRule.Public ? "public" : "private";
opts.price = Number(this.state.price) * 100;
return opts;
}
Expand Down Expand Up @@ -234,11 +231,10 @@ export default class CreateRoomDialog extends React.Component<IProps, IState> {
if (this.state.useModuleCreation) {
try {
this.validateModuleRoom();
} catch (e) {
alert((e as Error).message);
return;
}

} catch (e) {
alert((e as Error).message);
return;
}
}
this.props.onFinished(true, this.roomCreateOptions());
} else {
Expand Down Expand Up @@ -326,11 +322,7 @@ export default class CreateRoomDialog extends React.Component<IProps, IState> {
throw new Error("Keyword inválida");
}

if (
this.state.visible &&
this.state.joinRule !== JoinRule.Public &&
Number(this.state.price) <= 0
) {
if (this.state.visible && this.state.joinRule !== JoinRule.Public && Number(this.state.price) <= 0) {
this.setState({
invalidPrice: true,
});
Expand Down Expand Up @@ -553,27 +545,25 @@ export default class CreateRoomDialog extends React.Component<IProps, IState> {
/>
</details>
)}
<Field
<Field
label="Keyword"
value={this.state.keyword}
onChange={(e: React.ChangeEvent<HTMLInputElement>) => this.setState({
keyword: e.target.value,
keywordAlreadyExists: false,
})}
onChange={(e: React.ChangeEvent<HTMLInputElement>) =>
this.setState({
keyword: e.target.value,
keywordAlreadyExists: false,
})
}
/>

<SettingsToggleInput
name="visible"
label="Exibir no Explore"
checked={this.state.visible}
onChange={(e) =>
this.setState({ visible: e.target.checked })
}
onChange={(e) => this.setState({ visible: e.target.checked })}
/>

{
this.state.visible &&
this.state.joinRule !== JoinRule.Public && (
{this.state.visible && this.state.joinRule !== JoinRule.Public && (
<>
<Field
label="Preço"
Expand All @@ -584,23 +574,14 @@ export default class CreateRoomDialog extends React.Component<IProps, IState> {
invalidPrice: false,
})
}
className={
this.state.invalidPrice
? "mx_Field_invalid"
: undefined
}
className={this.state.invalidPrice ? "mx_Field_invalid" : undefined}
/>

{
this.state.invalidPrice && (
<div className="mx_Field_error">
Escolha um valor maior que zero.
</div>
)
}
{this.state.invalidPrice && (
<div className="mx_Field_error">Escolha um valor maior que zero.</div>
)}
</>
)
}
)}
</Form.Root>
</div>
<DialogButtons
Expand Down
Loading
Loading