Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use element home screen to create new chats by default #38

Closed
wants to merge 39 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
720ec43
merge write into chat-create-messages
Jun 1, 2023
b160178
add missing code for avatar check
Jun 1, 2023
6a9c233
add first basic function to create new rooms
Jun 1, 2023
9ff29df
use element home screen for chat actions
Jun 1, 2023
7c6c4cd
wrap Link content in span
Jun 6, 2023
11a4584
merge main into chat-create-messages
Aug 15, 2023
a6c7a3a
add colour to textbutton
Aug 15, 2023
88484b7
add ability to switch between room view and create room view on mobil…
Aug 15, 2023
fbc677a
add optional onClick function to bypass dropdown
Aug 15, 2023
6aac5f9
remove debuggin code
Aug 15, 2023
ee2705b
add comment, remove unused code
Aug 15, 2023
421c95a
merge main into chat-create-messages
Oct 11, 2023
d3c41ab
chore: remove unused code
Oct 11, 2023
7872233
merge main into chat-create-messages
Nov 22, 2023
019704a
refactor: remove device detection and use breakpoints for mobile view…
Nov 22, 2023
ffb8e46
add breakpoint integers for convenience
Nov 28, 2023
75629fd
refactor: improve logic for switiching between mobile and desktop views
Nov 28, 2023
fa85e91
refactor: make sure loading spinner is displayed before iframe is loa…
aofn Nov 28, 2023
88955e2
merge main into chat-create-messages
aofn Nov 28, 2023
1dc43a5
fix: make service submenu work again if not options are given and onC…
aofn Nov 28, 2023
78f4297
chore: remove logs and unsued code
aofn Nov 28, 2023
c15679f
refactor: improve logic around loading spinner and fix for larger screns
aofn Nov 28, 2023
dce50fb
merge main into chat-create-message
aofn Nov 29, 2023
55f5d1d
refactor: move deleting chat into chat header, swap icon
aofn Nov 29, 2023
43e2574
Merge remote-tracking branch 'origin/main' into chat-create-messages
aofn Nov 29, 2023
f6901b9
fix: css injections
aofn Nov 29, 2023
0443b68
fix: dont render avatar at the moment since its braking the layout atm
aofn Nov 29, 2023
b600cb5
refactor: add optional notification variable to ServiceLink.js
aofn Nov 30, 2023
d7a6fe7
refactor: use ServiceLink component for chat rooms
aofn Nov 30, 2023
27238c9
chore: fix eslint/stylelint formatting issues
andirueckel Nov 30, 2023
327c7f3
chore: remove trailing whitespaces
andirueckel Nov 30, 2023
10e8a7a
chore: fix formatting and comment temporarily unused Avatar
andirueckel Nov 30, 2023
a623c3c
style: improve NotificationBadge styling; needs re-positioning
andirueckel Nov 30, 2023
c01820d
style: refactor ServiceLink for use in `/chat` route
andirueckel Nov 30, 2023
670af5a
refactor: fix table without using grid and use actual notification co…
aofn Nov 30, 2023
6197c18
refactor: make style lint happy
aofn Nov 30, 2023
97e2558
refactor: create component for summary
aofn Nov 30, 2023
58a39a3
chore: improve comment
aofn Nov 30, 2023
7f4e297
Merge branch 'main' into chat-create-messages
fnwbr Dec 6, 2023
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ config.js

# misc
.DS_Store
/.idea
*.pem

# debug
Expand Down
60 changes: 53 additions & 7 deletions components/UI/ServiceLink.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,24 +19,70 @@ const LockIconWrapper = styled(Icon)`
}
`;

const ServiceLink = forwardRef(({ name, href, selected, passwordProtected }, ref) => {
const BlockLink = styled(Link)`
display: block;
`;

const NotificationBadge = styled.span`
justify-self: end;
padding: 0 calc(var(--margin) / 4);
line-height: var(--line-height);
color: rgb(255 255 255);
background-color: var(--color-notification);

> small {
font-weight: 600;
}
`;

const Avatar = styled.img`
Fixed Show fixed Hide fixed
position: relative;
float: left;
width: 2rem;
height: 2rem;
background-color: var(--color-foreground);

&.placeholder {
backdrop-filter: invert(100%);
}
`;

const ServiceLink = forwardRef(({ name, href, selected, passwordProtected, notifications, avatar }, ref) => {
const { t } = useTranslation();

return (
<ServiceTable.Row>
<ServiceTable.Cell>
{ /* Tell if this is our active item by displaying an arrow */ }
{ selected && <span style={{ float: 'right' }}>→</span> }
<Link
style={{ display: 'block' }}
{ avatar && (
<ServiceTable.Cell>
<Avatar src={avatar} alt={name} />
</ServiceTable.Cell>)
}
<ServiceTable.Cell width="100%">
<BlockLink
ref={ref}
href={href}
>
{ name }
{ /* Show a lock icon if this Link is password protected */ }
{ passwordProtected && <LockIconWrapper title={t('password protected')}><LockIcon /></LockIconWrapper> }
</Link>
</BlockLink>
</ServiceTable.Cell>
{ /* Tell if this is our active item by displaying an arrow */ }
{ selected &&
<ServiceTable.Cell align="right">
</ServiceTable.Cell>
}
{ /* Show notification badge if there are notifications */ }
{ !selected && notifications > 0 &&
<ServiceTable.Cell>
<NotificationBadge>
<small>
{ notifications < 100 ? notifications : '99+' }
</small>
</NotificationBadge>
</ServiceTable.Cell>
}
</ServiceTable.Row>
);
});
Expand Down
6 changes: 3 additions & 3 deletions components/UI/ServiceSubmenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ const Submenu = styled.aside`
}
`;

export function ServiceSubmenu({ title, icon, subheadline, items, disabled }) {
export function ServiceSubmenu({ title, icon, subheadline, items, disabled, onClick }) {
const { t } = useTranslation();
const [isOpen, setIsOpen] = useState(false);
const [value, setValue] = useState('');
Expand All @@ -53,7 +53,7 @@ export function ServiceSubmenu({ title, icon, subheadline, items, disabled }) {
{ title && title }
<ToggleButton
disabled={disabled}
onClick={handleMenuToggle}>
onClick={onClick || handleMenuToggle}>
{ icon ?
icon
:
Expand All @@ -63,7 +63,7 @@ export function ServiceSubmenu({ title, icon, subheadline, items, disabled }) {
}
</ToggleButton>
</Header>
{ isOpen && (
{ isOpen && items && (
<Submenu>
{ subheadline && <h3>{ subheadline }</h3> }
<select
Expand Down
2 changes: 2 additions & 0 deletions components/_breakpoints.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
export const breakpoints = {
phoneOnly: `(max-width: 1079px)`,
tabletAndAbove: `(min-width: 1080px)`,
phoneBreakpoint: 1079,
tabletAndAboveBreakpoint: 1080,
};
20 changes: 16 additions & 4 deletions lib/auth/MatrixAuthProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,21 +112,22 @@ class MatrixAuthProvider {
* @param {string} type - The type of the room or space.
* @param {string} template - The template for the room or space.
* @param {string} parentId - The ID of the parent space, if any.
* @TODO: Missing some @param declarations
* @returns {Promise<Object>} A promise that resolves to the created room or space.
* @throws {Error} If there was an error creating the room or space.
*/
async createRoom(name, isSpace, topic, joinRule, type, template, parentId) {
async createRoom(name, isSpace, topic, joinRule, type, template, parentId, application, visibility, historyVisible, encrypted) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where are we making use of any of these new parameters?
If we don't use them, let's not add them.

I guess this is a leftover from some previous concepts?

const opts = {
name: name,
preset: 'private_chat',
topic: topic,
visibility: 'private', // by default, we want rooms and spaces to be private, this can later be changed either in /content or /moderate
visibility: visibility || 'private', // by default, we want rooms and spaces to be private, this can later be changed either in /content or /moderate
creation_content: {
type: isSpace ? 'm.space' : 'm.room',
},
initial_state: [{
type: 'm.room.history_visibility',
content: { history_visibility: 'world_readable' }, // history has to be world_readable so content of the rooms is visible for everyone who joins the room at a later point in time
content: { history_visibility: historyVisible || 'world_readable' }, // history has to be world_readable so content of the rooms is visible for everyone who joins the room at a later point in time
},
{
type: 'm.room.join_rules',
Expand All @@ -152,6 +153,16 @@ class MatrixAuthProvider {
},
};

if (encrypted) {
opts.initial_state.push({
type: 'm.room.encryption',
state_key: '',
content: {
algorithm: 'm.megolm.v1.aes-sha2',
},
});
}

if (parentId) {
opts.initial_state.push({
// Spec: https://spec.matrix.org/v1.9/client-server-api/#mspaceparent
Expand All @@ -169,7 +180,8 @@ class MatrixAuthProvider {
const medienhausMetaEvent = {
type: type,
template: template,
version: '0.4',
application: application,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the difference between template and application?

At the same time, like I said above: I think we don't actually make use of this new "application" parameter anywhere. So let's remove it again?

version: '0.5',
};
await this.matrixClient.sendStateEvent(room.room_id, 'dev.medienhaus.meta', medienhausMetaEvent);

Expand Down
Loading
Loading