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

feat: New UI using Fuselage #2927

Merged
merged 61 commits into from
Sep 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
61 commits
Select commit Hold shift + click to select a range
47cd7e9
grow
jeanfbrito Jul 11, 2024
adc6f44
wip
jeanfbrito Jul 12, 2024
4ab5789
button group added
jeanfbrito Jul 17, 2024
673b81e
wip
jeanfbrito Jul 18, 2024
b405214
open settings panel
jeanfbrito Jul 23, 2024
7674891
fix settings view
jeanfbrito Jul 23, 2024
ad12ab5
fix downloads view
jeanfbrito Jul 23, 2024
2dcc798
fix badges
jeanfbrito Jul 24, 2024
248f5b6
top bar title update
jeanfbrito Jul 25, 2024
2246906
only show topbar on osx
jeanfbrito Jul 29, 2024
519e49c
persistMachineTheme
jeanfbrito Jul 31, 2024
89e8893
changes theme by server and machine as callback
jeanfbrito Jul 31, 2024
af784b4
change topbar to the page title
jeanfbrito Aug 1, 2024
48412cb
settings now supports themes
jeanfbrito Aug 1, 2024
200681f
downloads with theme
jeanfbrito Aug 1, 2024
a8ecd6d
add actions to settings kebab menu
jeanfbrito Aug 5, 2024
3cddbe0
hide sidebar
jeanfbrito Aug 6, 2024
61afefa
add menu translation
jeanfbrito Aug 7, 2024
8473b5c
wip actions menu
jeanfbrito Aug 8, 2024
d56337c
add server menu actions
jeanfbrito Aug 9, 2024
bbad94c
add other actions
jeanfbrito Aug 9, 2024
eba113d
fix server remove click propagation
jeanfbrito Aug 9, 2024
392dc9b
working tooltips
jeanfbrito Aug 9, 2024
44c3737
add tooltips translation
jeanfbrito Aug 9, 2024
a9e444b
fix wrong tooltip when context menu is open
jeanfbrito Aug 9, 2024
3686195
fix lint
jeanfbrito Aug 12, 2024
b0e576f
bump to rebuild
jeanfbrito Aug 12, 2024
93e5be6
update fuselage
jeanfbrito Aug 14, 2024
8121269
fix tooltip theme
jeanfbrito Aug 14, 2024
9a90f9a
wip
jeanfbrito Aug 14, 2024
570cb2a
done tooltip provider
jeanfbrito Aug 14, 2024
a5f63d2
finish tooltip provider
jeanfbrito Aug 14, 2024
da02ae7
wip settings tooltip
jeanfbrito Aug 14, 2024
f373bb0
convert to rocket.chat tooltip provider
jeanfbrito Aug 14, 2024
a639b53
fix debounce
jeanfbrito Aug 14, 2024
845584b
lint fix
jeanfbrito Aug 14, 2024
c557a37
fix tooltip being stuck
jeanfbrito Aug 14, 2024
4305bbf
settings tooltip update
jeanfbrito Aug 15, 2024
99837d7
lint fix
jeanfbrito Aug 15, 2024
ae74185
fix breaking theme selection
jeanfbrito Aug 19, 2024
adedb52
update node version
jeanfbrito Aug 19, 2024
c8f5bc6
node update
jeanfbrito Aug 19, 2024
2db22cc
Fix build pr (#2930)
jeanfbrito Aug 20, 2024
f04c2f3
update fuselage icons
jeanfbrito Aug 20, 2024
a1c1ab5
Merge branch 'new-ui' of https://github.com/RocketChat/Rocket.Chat.El…
jeanfbrito Aug 20, 2024
e7a19e6
rollback fuselage icons
jeanfbrito Aug 20, 2024
f199dcb
update puppeteer
jeanfbrito Aug 21, 2024
5948b16
change node to the actions default
jeanfbrito Aug 21, 2024
9f141d9
update validate-pr action
jeanfbrito Aug 21, 2024
9af18f3
fix path
jeanfbrito Aug 21, 2024
49ad226
Pr comments (#2933)
jeanfbrito Aug 21, 2024
f0c40a2
convert unsupported server to fuselage
jeanfbrito Aug 22, 2024
1943140
Merge branch 'new-ui' of https://github.com/RocketChat/Rocket.Chat.El…
jeanfbrito Aug 22, 2024
78515db
lint fix
jeanfbrito Aug 22, 2024
52b259b
add translations
jeanfbrito Sep 6, 2024
347ec59
make theme change on server theme change
jeanfbrito Sep 6, 2024
c835aa8
add old selected state
jeanfbrito Sep 9, 2024
f353dcd
Merge branch 'master' into new-ui
jeanfbrito Sep 9, 2024
470efd1
lint fix
jeanfbrito Sep 9, 2024
c843581
fix select color theme
jeanfbrito Sep 9, 2024
05faa74
remove unread marker
jeanfbrito Sep 10, 2024
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
14 changes: 8 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@
},
"main": "app/main.js",
"scripts": {
"postinstall": "run-s install-app-deps clean",
"postinstall": "run-s install-app-deps clean patch-package",
"patch-package": "patch-package",
"start": "run-s build:watch",
"clean": "rimraf app dist",
"build": "rollup -c",
Expand All @@ -38,7 +39,7 @@
"build-assets-win": "ts-node -O \"{\\\"module\\\":\\\"commonjs\\\"}\" src/buildAssets.ts",
"release": "yarn electron-builder --publish onTagOrDraft --x64",
"install-app-deps": "electron-builder install-app-deps",
"test": "xvfb-maybe jest",
"test": "xvfb-maybe jest --forceExit --detectOpenHandles --maxWorkers=1",
"changelog": "conventional-changelog -p angular -i CHANGELOG.md -s",
"lint": "run-s .:lint:eslint .:lint:tsc",
".:lint:eslint": "eslint .",
Expand All @@ -54,10 +55,10 @@
"@emotion/styled": "~11.11.0",
"@ewsjs/xhr": "~2.0.2",
"@rocket.chat/css-in-js": "~0.31.25",
"@rocket.chat/fuselage": "~0.54.2",
"@rocket.chat/fuselage": "0.58.0",
"@rocket.chat/fuselage-hooks": "~0.33.1",
"@rocket.chat/fuselage-polyfills": "~0.31.25",
"@rocket.chat/icons": "~0.36.0",
"@rocket.chat/icons": "0.37.0",
"axios": "~1.6.4",
"electron-dl": "3.5.2",
"electron-store": "~8.1.0",
Expand Down Expand Up @@ -88,7 +89,7 @@
"@babel/preset-typescript": "~7.23.3",
"@fiahfy/icns-convert": "~0.0.12",
"@fiahfy/ico-convert": "~0.0.12",
"@kayahr/jest-electron-runner": "~29.11.0",
"@kayahr/jest-electron-runner": "29.14.0",
"@rocket.chat/eslint-config": "~0.7.0",
"@rocket.chat/prettier-config": "~0.31.25",
"@rollup/plugin-babel": "~6.0.4",
Expand All @@ -108,7 +109,7 @@
"chokidar": "~3.5.3",
"conventional-changelog-cli": "~4.1.0",
"convert-svg-to-png": "~0.6.4",
"electron": "30.1.2",
"electron": "30.4.0",
"electron-builder": "24.13.3",
"electron-devtools-installer": "^3.2.0",
"electron-notarize": "^1.2.2",
Expand All @@ -123,6 +124,7 @@
"jest-environment-jsdom": "~29.7.0",
"jimp": "~0.22.10",
"npm-run-all": "~4.1.5",
"patch-package": "~8.0.0",
"prettier": "~3.2.5",
"puppeteer": "23.1.1",
"rollup": "~4.9.6",
Expand Down
30 changes: 30 additions & 0 deletions patches/@kayahr+jest-electron-runner+29.14.0.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
diff --git a/node_modules/@kayahr/jest-electron-runner/lib/main/electron/TestRunner.js b/node_modules/@kayahr/jest-electron-runner/lib/main/electron/TestRunner.js
index 4485862..f34ba6a 100644
--- a/node_modules/@kayahr/jest-electron-runner/lib/main/electron/TestRunner.js
+++ b/node_modules/@kayahr/jest-electron-runner/lib/main/electron/TestRunner.js
@@ -66,14 +66,19 @@ async function startWorker(rootDir, target, config) {
DISPOSABLES.add(() => {
if (child.pid != null) {
try {
- // Kill whole process group with negative PID (See `man kill`)
- process.kill(-child.pid, "SIGKILL");
- }
- catch {
- // Ignored
+ if (process.platform === 'win32') {
+ // On Windows, use taskkill instead of process.kill
+ require('child_process').execSync(`taskkill /pid ${child.pid} /T /F`);
+ } else {
+ // Kill whole process group with negative PID (See `man kill`)
+ process.kill(-child.pid, 'SIGKILL');
+ }
+ } catch (error) {
+ console.error('Failed to kill process:', error);
}
}
- child.kill("SIGKILL");
+ // Fallback kill (this can remain as it works for most platforms)
+ child.kill('SIGKILL');
});
return child;
});
25 changes: 20 additions & 5 deletions src/.jest/setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,28 @@ expect.extend({
promise: this.promise,
};

const normalizedReceived = path.normalize(received);
const normalizedExpected = path.normalize(fullExpectedPath);

console.log('Normalized Received:', normalizedReceived);
console.log('Normalized Expected:', normalizedExpected);

return {
pass: path.relative(received, fullExpectedPath) === '',
pass: normalizedReceived === normalizedExpected,
message: () =>
`${ this.utils.matcherHint('toMatchAppPath', undefined, undefined, options)
}\n\n`
+ `Expected: ${ this.utils.printExpected(fullExpectedPath) }\n`
+ `Received: ${ this.utils.printReceived(received) }`,
`${this.utils.matcherHint('toMatchAppPath', undefined, undefined, options)}\n\n` +
`Expected: ${this.utils.printExpected(normalizedExpected)}\n` +
`Received: ${this.utils.printReceived(normalizedReceived)}`,
};
},
});

process.on('unhandledRejection', (reason, promise) => {
console.error('Unhandled Rejection at:', promise, 'reason:', reason);
process.exit(1);
});

process.on('uncaughtException', (error) => {
console.error('Uncaught Exception:', error);
process.exit(1);
});
10 changes: 10 additions & 0 deletions src/app/PersistableValues.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,11 @@ type PersistableValues_3_9_6 = PersistableValues_3_8_12 & {
isNTLMCredentialsEnabled: boolean;
};

type PersistableValues_4_1_0 = PersistableValues_3_9_6 & {
mainWindowTitle: string;
machineTheme: string;
};

export type PersistableValues = Pick<
PersistableValues_3_9_6,
keyof PersistableValues_3_9_6
Expand Down Expand Up @@ -121,4 +126,9 @@ export const migrations = {
allowedNTLMCredentialsDomains: null,
lastSelectedServerUrl: '',
}),
'>=4.1.0': (before: PersistableValues_3_9_6): PersistableValues_4_1_0 => ({
...before,
mainWindowTitle: 'Rocket.Chat',
machineTheme: 'light',
}),
};
4 changes: 4 additions & 0 deletions src/app/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,15 @@ export const APP_VERSION_SET = 'app/version-set';
export const APP_SETTINGS_LOADED = 'app/settings-loaded';
export const APP_ALLOWED_NTLM_CREDENTIALS_DOMAINS_SET =
'app/allowed-ntlm-credentials-domains-set';
export const APP_MAIN_WINDOW_TITLE_SET = 'app/main-window-title-set';
export const APP_MACHINE_THEME_SET = 'app/machine-theme-set';

export type AppActionTypeToPayloadMap = {
[APP_ERROR_THROWN]: Error;
[APP_PATH_SET]: string;
[APP_VERSION_SET]: string;
[APP_SETTINGS_LOADED]: Partial<PersistableValues>;
[APP_ALLOWED_NTLM_CREDENTIALS_DOMAINS_SET]: string;
[APP_MAIN_WINDOW_TITLE_SET]: string;
[APP_MACHINE_THEME_SET]: string;
};
15 changes: 15 additions & 0 deletions src/app/main/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import { askForClearScreenCapturePermission } from '../../ui/main/dialogs';
import { getRootWindow } from '../../ui/main/rootWindow';
import {
APP_ALLOWED_NTLM_CREDENTIALS_DOMAINS_SET,
APP_MAIN_WINDOW_TITLE_SET,
APP_PATH_SET,
APP_VERSION_SET,
} from '../actions';
Expand All @@ -35,6 +36,19 @@ export const electronBuilderJsonInformation = {
protocol: electronBuilderJson.protocols.schemes[0],
};

export const getPlatformName = (): string => {
switch (process.platform) {
case 'win32':
return 'Windows';
case 'linux':
return 'Linux';
case 'darwin':
return 'macOS';
default:
return 'Unknown';
}
};

export const relaunchApp = (...args: string[]): void => {
const command = process.argv.slice(1, app.isPackaged ? 1 : 2);
app.relaunch({ args: [...command, ...args] });
Expand Down Expand Up @@ -151,4 +165,5 @@ export const setupApp = (): void => {

dispatch({ type: APP_PATH_SET, payload: app.getAppPath() });
dispatch({ type: APP_VERSION_SET, payload: app.getVersion() });
dispatch({ type: APP_MAIN_WINDOW_TITLE_SET, payload: 'Rocket.Chat' });
};
20 changes: 20 additions & 0 deletions src/app/reducers/machineTheme.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import type { Reducer } from 'redux';

import type { ActionOf } from '../../store/actions';
import { APP_MACHINE_THEME_SET } from '../actions';

type MachineThemeAction = ActionOf<typeof APP_MACHINE_THEME_SET>;

export const machineTheme: Reducer<string | null, MachineThemeAction> = (
state = 'light',
action
) => {
switch (action.type) {
case APP_MACHINE_THEME_SET: {
return action.payload;
}

default:
return state;
}
};
19 changes: 19 additions & 0 deletions src/app/reducers/mainWindowTitle.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import type { Reducer } from 'redux';

import type { ActionOf } from '../../store/actions';
import { APP_MAIN_WINDOW_TITLE_SET } from '../actions';

type MainWindowTitleAction = ActionOf<typeof APP_MAIN_WINDOW_TITLE_SET>;

export const mainWindowTitle: Reducer<string | null, MainWindowTitleAction> = (
state = null,
action
) => {
switch (action.type) {
case APP_MAIN_WINDOW_TITLE_SET:
return action.payload;

default:
return state;
}
};
1 change: 1 addition & 0 deletions src/app/selectors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export const selectPersistableValues = createStructuredSelector({
doCheckForUpdatesOnStartup: ({ doCheckForUpdatesOnStartup }: RootState) =>
doCheckForUpdatesOnStartup,
downloads: ({ downloads }: RootState) => downloads,
machineTheme: ({ machineTheme }: RootState) => machineTheme,
isMenuBarEnabled: ({ isMenuBarEnabled }: RootState) => isMenuBarEnabled,
isShowWindowOnUnreadChangedEnabled: ({
isShowWindowOnUnreadChangedEnabled,
Expand Down
12 changes: 10 additions & 2 deletions src/i18n/en.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -325,14 +325,22 @@
"addNewServer": "Add new server",
"downloads": "Downloads",
"settings": "Settings",
"menuTitle": "Customize and control app",
"item": {
"reload": "Reload server",
"remove": "Remove server",
"reload": "Reload",
"remove": "Remove",
"openDevTools": "Open DevTools",
"clearCache": "Clear Cache",
"clearStorageData": "Clear Storage Data",
"copyCurrentUrl": "Copy current URL",
"reloadClearingCache": "Force reload"
},
"tooltips": {
"unreadMessage": "{{- count}} unread message",
"unreadMessages": "{{- count}} unread messages",
"userNotLoggedIn": "Not logged in",
"addWorkspace": "Add workspace ({{shortcut}}+N)",
"settingsMenu": "Customize and control app"
}
},
"touchBar": {
Expand Down
14 changes: 11 additions & 3 deletions src/i18n/pt-BR.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -310,14 +310,22 @@
"addNewServer": "Adicionar novo servidor",
"downloads": "Downloads",
"settings": "Configurações",
"menuTitle": "Personalizar e controlar app",
"item": {
"reload": "Recarregar servidor",
"remove": "Remover servidor",
"reload": "Recarregar",
"remove": "Remover",
"openDevTools": "Abrir DevTools",
"clearCache": "Limpar cache",
"clearStorageData": "Limpar dados de armazenamento",
"copyCurrentUrl": "Copiar URL atual",
"copyCurrentUrl": "Copiar URL",
"reloadClearingCache": "Forçar recarregamento"
},
"tooltips": {
"unreadMessage": "{{- count}} mensagem não lida",
"unreadMessages": "{{- count}} mensagens não lidas",
"userNotLoggedIn": "Não conectado",
"addWorkspace": "Adicionar workspace ({{shortcut}}+N)",
"settingsMenu": "Personalizar e controlar app"
}
},
"touchBar": {
Expand Down
3 changes: 2 additions & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import {
createRootWindow,
showRootWindow,
exportLocalStorage,
watchMachineTheme,
} from './ui/main/rootWindow';
import { attachGuestWebContentsEvents } from './ui/main/serverView';
import touchBar from './ui/main/touchBar';
Expand Down Expand Up @@ -71,7 +72,7 @@ const start = async (): Promise<void> => {
// if (process.env.NODE_ENV === 'development') {
// installDevTools();
// }

watchMachineTheme();
setupNotifications();
setupScreenSharing();
startVideoCallWindowHandler();
Expand Down
1 change: 1 addition & 0 deletions src/servers/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import type { SupportedVersions } from './supportedVersions/types';
export type Server = {
url: string;
title?: string;
pageTitle?: string;
badge?: '•' | number;
favicon?: string | null;
style?: {
Expand Down
12 changes: 11 additions & 1 deletion src/servers/reducers.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
/* eslint-disable complexity */
import type { Reducer } from 'redux';

import { APP_SETTINGS_LOADED } from '../app/actions';
import { DEEP_LINKS_SERVER_ADDED } from '../deepLinks/actions';
import { OUTLOOK_CALENDAR_SAVE_CREDENTIALS } from '../outlookCalendar/actions';
import type { ActionOf } from '../store/actions';
import type { SIDE_BAR_SERVER_REMOVE } from '../ui/actions';
import {
WEBVIEW_PAGE_TITLE_CHANGED,
ADD_SERVER_VIEW_SERVER_ADDED,
SIDE_BAR_REMOVE_SERVER_CLICKED,
SIDE_BAR_SERVERS_SORTED,
Expand Down Expand Up @@ -66,7 +69,9 @@ type ServersActionTypes =
| ActionOf<typeof WEBVIEW_SERVER_VERSION_UPDATED>
| ActionOf<typeof SUPPORTED_VERSION_DIALOG_DISMISS>
| ActionOf<typeof SERVER_DOCUMENT_VIEWER_OPEN_URL>
| ActionOf<typeof WEBVIEW_USER_THEME_APPEARANCE_CHANGED>;
| ActionOf<typeof WEBVIEW_PAGE_TITLE_CHANGED>
| ActionOf<typeof WEBVIEW_USER_THEME_APPEARANCE_CHANGED>
| ActionOf<typeof SIDE_BAR_SERVER_REMOVE>;

const upsert = (state: Server[], server: Server): Server[] => {
const index = state.findIndex(({ url }) => url === server.url);
Expand Down Expand Up @@ -120,6 +125,11 @@ export const servers: Reducer<Server[], ServersActionTypes> = (
return upsert(state, { url, title });
}

case WEBVIEW_PAGE_TITLE_CHANGED: {
const { url, pageTitle } = action.payload;
return upsert(state, { url, pageTitle });
}

case WEBVIEW_SERVER_SUPPORTED_VERSIONS_UPDATED: {
const { url, supportedVersions, source } = action.payload;
return upsert(state, {
Expand Down
4 changes: 4 additions & 0 deletions src/store/rootReducer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import { combineReducers } from 'redux';
import { allowedNTLMCredentialsDomains } from '../app/reducers/allowedNTLMCredentialsDomains';
import { appPath } from '../app/reducers/appPath';
import { appVersion } from '../app/reducers/appVersion';
import { machineTheme } from '../app/reducers/machineTheme';
import { mainWindowTitle } from '../app/reducers/mainWindowTitle';
import { downloads } from '../downloads/reducers/downloads';
import { allowedJitsiServers } from '../jitsi/reducers';
import {
Expand Down Expand Up @@ -60,6 +62,8 @@ export const rootReducer = combineReducers({
isMinimizeOnCloseEnabled,
isUpdatingAllowed,
isUpdatingEnabled,
mainWindowTitle,
machineTheme,
newUpdateVersion,
openDialog,
rootWindowIcon,
Expand Down
Loading
Loading