MM-45981_Desktop: Add Server Screen: Improve Onboarding screens (#2243)

This commit is contained in:
Julian Mondragón
2022-09-16 10:35:37 -05:00
committed by GitHub
parent c12dc3d6ae
commit c3493b09ff
24 changed files with 1920 additions and 100 deletions

View File

@@ -246,6 +246,7 @@ describe('main/app/intercom', () => {
Config.set.mockImplementation((name, value) => {
Config[name] = value;
});
Config.teams = JSON.parse(JSON.stringify([]));
});
it('should show welcomeScreen modal', async () => {
@@ -253,7 +254,7 @@ describe('main/app/intercom', () => {
ModalManager.addModal.mockReturnValue(promise);
handleWelcomeScreenModal();
expect(ModalManager.addModal).toHaveBeenCalledWith('welcomeScreen', '/some/index.html', '/some/preload.js', {}, {}, true);
expect(ModalManager.addModal).toHaveBeenCalledWith('welcomeScreen', '/some/index.html', '/some/preload.js', [], {}, true);
});
});
});

View File

@@ -238,10 +238,16 @@ export function handleWelcomeScreenModal() {
if (!mainWindow) {
return;
}
const modalPromise = ModalManager.addModal('welcomeScreen', html, modalPreload, {}, mainWindow, true);
const modalPromise = ModalManager.addModal<TeamWithIndex[], Team>('welcomeScreen', html, modalPreload, Config.teams.map((team, index) => ({...team, index})), mainWindow, Config.teams.length === 0);
if (modalPromise) {
modalPromise.then(() => {
handleNewServerModal();
modalPromise.then((data) => {
const teams = Config.teams;
const order = teams.length;
const newTeam = getDefaultTeamWithTabsFromTeam({...data, order});
teams.push(newTeam);
Config.set('teams', teams);
updateServerInfos([newTeam]);
WindowManager.switchServer(newTeam.name, true);
}).catch((e) => {
// e is undefined for user cancellation
if (e) {