MM-45981_Desktop: Add Server Screen: Improve Onboarding screens (#2243)
This commit is contained in:
@@ -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);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@@ -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) {
|
||||
|
Reference in New Issue
Block a user