Merge branch 'main' into invite-link
This commit is contained in:
commit
e8527df962
10 changed files with 67 additions and 63 deletions
|
@ -37,9 +37,14 @@ const Fractal: TextClient = {
|
|||
case LinkKind.Alias:
|
||||
case LinkKind.RoomId:
|
||||
case LinkKind.UserId:
|
||||
return <span>Click the '+' button in the top right</span>;
|
||||
return (
|
||||
<span>
|
||||
Click the '+' button in the top right and paste the
|
||||
identifier
|
||||
</span>
|
||||
);
|
||||
default:
|
||||
return <span>Weechat doesn't support this kind of link</span>;
|
||||
return <span>Fractal doesn't support this kind of link</span>;
|
||||
}
|
||||
},
|
||||
copyString: (link) => {
|
||||
|
@ -63,7 +68,7 @@ const Fractal: TextClient = {
|
|||
}
|
||||
},
|
||||
|
||||
description: 'Command-line Matrix interface using Weechat',
|
||||
description: 'Fractal is a Matrix Client written in Rust',
|
||||
};
|
||||
|
||||
export default Fractal;
|
||||
|
|
|
@ -39,19 +39,22 @@ const ClientTile: React.FC<IProps> = ({ client, link }: IProps) => {
|
|||
clientTileLink: client.kind === ClientKind.LINKED_CLIENT,
|
||||
});
|
||||
|
||||
const inviteButton =
|
||||
client.kind === ClientKind.LINKED_CLIENT ? (
|
||||
<Button>Accept invite</Button>
|
||||
) : (
|
||||
let inviteButton: JSX.Element = <></>;
|
||||
if (client.kind === ClientKind.LINKED_CLIENT) {
|
||||
inviteButton = <Button>Accept invite</Button>;
|
||||
} else {
|
||||
const copyString = client.copyString(link);
|
||||
if (copyString !== '') {
|
||||
inviteButton = (
|
||||
<Button
|
||||
onClick={() =>
|
||||
navigator.clipboard.writeText(client.copyString(link))
|
||||
}
|
||||
onClick={() => navigator.clipboard.writeText(copyString)}
|
||||
flashChildren="Invite copied"
|
||||
>
|
||||
Copy invite
|
||||
</Button>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
let clientTile = (
|
||||
<Tile className={className}>
|
||||
|
|
|
@ -35,7 +35,7 @@ limitations under the License.
|
|||
color: $foreground;
|
||||
}
|
||||
|
||||
h1 {
|
||||
.linkHeader h1 {
|
||||
word-break: break-all;
|
||||
}
|
||||
|
||||
|
|
|
@ -128,7 +128,7 @@ const LinkCreatedTile: React.FC<ILinkCreatedTileProps> = (props) => {
|
|||
<div>New link</div>
|
||||
<img src={refreshIcon} alt="Go back to matrix.to home page" />
|
||||
</button>
|
||||
<h1>{props.link}</h1>
|
||||
<h1 className="linkHeader">{props.link}</h1>
|
||||
<Button
|
||||
flashChildren={'Copied'}
|
||||
icon={copyIcon}
|
||||
|
|
|
@ -24,7 +24,7 @@ const EventSchema = object({
|
|||
origin_server_ts: string(),
|
||||
unsigned: object({}).nonstrict().optional(),
|
||||
room_id: string(),
|
||||
});
|
||||
}).nonstrict();
|
||||
|
||||
export type Event = TypeOf<typeof EventSchema>;
|
||||
export default EventSchema;
|
||||
|
|
|
@ -26,18 +26,16 @@ export const RoomSchema = object({
|
|||
world_readable: boolean(),
|
||||
guest_can_join: boolean(),
|
||||
avatar_url: string().optional(),
|
||||
});
|
||||
|
||||
}).nonstrict();
|
||||
|
||||
const PublicRoomsSchema = object({
|
||||
chunk: array(RoomSchema),
|
||||
next_batch: string().optional(),
|
||||
prev_batch: string().optional(),
|
||||
total_room_count_estimate: number().optional(),
|
||||
});
|
||||
}).nonstrict();
|
||||
|
||||
export type Room = TypeOf<typeof RoomSchema>;
|
||||
export type PublicRooms = TypeOf<typeof PublicRoomsSchema>;
|
||||
|
||||
export default PublicRoomsSchema;
|
||||
|
||||
|
|
|
@ -19,8 +19,7 @@ import { object, array, string, TypeOf } from 'zod';
|
|||
const RoomAliasSchema = object({
|
||||
room_id: string(),
|
||||
servers: array(string()),
|
||||
});
|
||||
}).nonstrict();
|
||||
|
||||
export type RoomAlias = TypeOf<typeof RoomAliasSchema>;
|
||||
export default RoomAliasSchema;
|
||||
|
||||
|
|
|
@ -19,8 +19,7 @@ import { object, string, TypeOf } from 'zod';
|
|||
const UserSchema = object({
|
||||
avatar_url: string().optional(),
|
||||
displayname: string().optional(),
|
||||
})
|
||||
}).nonstrict();
|
||||
|
||||
export type User = TypeOf<typeof UserSchema>;
|
||||
export default UserSchema;
|
||||
|
||||
|
|
|
@ -18,12 +18,12 @@ import { object, string, TypeOf } from 'zod';
|
|||
|
||||
const WellKnownSchema = object({
|
||||
'm.homeserver': object({
|
||||
'base_url': string().url(),
|
||||
base_url: string().url(),
|
||||
}),
|
||||
'm.identity_server': object({
|
||||
'base_url': string().url(),
|
||||
}),
|
||||
});
|
||||
base_url: string().url(),
|
||||
}).optional(),
|
||||
}).nonstrict();
|
||||
|
||||
export type WellKnown = TypeOf<typeof WellKnownSchema>;
|
||||
export default WellKnownSchema;
|
||||
|
|
|
@ -16,13 +16,13 @@ import {
|
|||
*/
|
||||
type Verifier<A> = [RegExp, A];
|
||||
export const roomVerifiers: Verifier<LinkKind.Alias | LinkKind.RoomId>[] = [
|
||||
[/^#([^/:]+?):(.+)$/, LinkKind.Alias],
|
||||
[/^!([^/:]+?):(.+)$/, LinkKind.RoomId],
|
||||
[/^#([^:]*):(.+)$/, LinkKind.Alias],
|
||||
[/^!([^:]*):(.+)$/, LinkKind.RoomId],
|
||||
];
|
||||
export const verifiers: Verifier<LinkKind>[] = [
|
||||
[/^[!#]([^/:]+?):(.+?)\/\$([^/:]+?)$/, LinkKind.Permalink],
|
||||
[/^@([^/:]+?):(.+)$/, LinkKind.UserId],
|
||||
[/^\+([^/:]+?):(.+)$/, LinkKind.GroupId],
|
||||
[/^[!#]([^:]*):(.+)\/\$([^:]+):(.+)$/, LinkKind.Permalink],
|
||||
[/^@([^:]+):(.+)$/, LinkKind.UserId],
|
||||
[/^\+([^:]+):(.+)$/, LinkKind.GroupId],
|
||||
...roomVerifiers,
|
||||
];
|
||||
|
||||
|
|
Loading…
Reference in a new issue