(core) Improve the look and behavior of /welcome/teams page (also shown for /welcome/start)

Summary:
- Move css module for the login page css to core/, to be reusable in core/ pages.
- Move /welcome/teams implementation to WelcomeSitePicker.ts
- List users for personal sites, as well as team sites.
- Add org param to setSessionActive() API method and end endpoint, to allow
  switching the specified org to another user.
- Add a little safety to getOrgUrl() function.

Test Plan: Added a test case for the new behaviors of the /welcome/teams page.

Reviewers: georgegevoian

Reviewed By: georgegevoian

Differential Revision: https://phab.getgrist.com/D3914
This commit is contained in:
Dmitry S
2023-06-13 19:32:29 -04:00
parent 812cded291
commit 2740884e3c
12 changed files with 390 additions and 75 deletions

View File

@@ -386,6 +386,9 @@ export const ThemeColors = t.iface([], {
"highlighted-code-fg": "string",
"highlighted-code-border": "string",
"highlighted-code-bg-disabled": "string",
"login-page-bg": "string",
"login-page-backdrop": "string",
"login-page-line": "string",
});
const exportedTypeSuite: t.ITypeSuite = {

View File

@@ -504,6 +504,11 @@ export interface ThemeColors {
'highlighted-code-fg': string;
'highlighted-code-border': string;
'highlighted-code-bg-disabled': string;
/* Login Page */
'login-page-bg': string;
'login-page-backdrop': string;
'login-page-line': string;
}
export const ThemePrefsChecker = createCheckers(ThemePrefsTI).ThemePrefs as CheckerT<ThemePrefs>;

View File

@@ -333,7 +333,7 @@ export interface DocStateComparisonDetails {
export interface UserAPI {
getSessionActive(): Promise<ActiveSessionInfo>;
setSessionActive(email: string): Promise<void>;
setSessionActive(email: string, org?: string): Promise<void>;
getSessionAll(): Promise<{users: FullUser[], orgs: Organization[]}>;
getOrgs(merged?: boolean): Promise<Organization[]>;
getWorkspace(workspaceId: number): Promise<Workspace>;
@@ -487,8 +487,8 @@ export class UserAPIImpl extends BaseAPI implements UserAPI {
return this.requestJson(`${this._url}/api/session/access/active`, {method: 'GET'});
}
public async setSessionActive(email: string): Promise<void> {
const body = JSON.stringify({ email });
public async setSessionActive(email: string, org?: string): Promise<void> {
const body = JSON.stringify({ email, org });
return this.requestJson(`${this._url}/api/session/access/active`, {method: 'POST', body});
}

View File

@@ -483,4 +483,9 @@ export const GristDark: ThemeColors = {
'highlighted-code-fg': '#A4A4A4',
'highlighted-code-border': '#69697D',
'highlighted-code-bg-disabled': '#555563',
/* Login Page */
'login-page-bg': '#32323F',
'login-page-backdrop': '#404150',
'login-page-line': '#57575F',
};

View File

@@ -483,4 +483,9 @@ export const GristLight: ThemeColors = {
'highlighted-code-fg': '#929299',
'highlighted-code-border': '#D9D9D9',
'highlighted-code-bg-disabled': '#E8E8E8',
/* Login Page */
'login-page-bg': 'white',
'login-page-backdrop': '#F5F8FA',
'login-page-line': '#F7F7F7',
};