diff options
author | Bob Zeleznik <zzzman@gmail.com> | 2019-05-01 21:58:38 -0400 |
---|---|---|
committer | Bob Zeleznik <zzzman@gmail.com> | 2019-05-01 21:58:38 -0400 |
commit | 797b54c849d7c4691c470ac73da2bf468c68c4b0 (patch) | |
tree | 7df51fc2d2e66f2f7e396f1bfe7622236883ba6b | |
parent | ecb4c692c6f317c4108cb065874003fc51242f7a (diff) |
tweaked current user utils for workspace naming
-rw-r--r-- | src/client/views/Main.tsx | 8 | ||||
-rw-r--r-- | src/server/authentication/models/current_user_utils.ts | 3 |
2 files changed, 6 insertions, 5 deletions
diff --git a/src/client/views/Main.tsx b/src/client/views/Main.tsx index 2636b08bd..4e918221c 100644 --- a/src/client/views/Main.tsx +++ b/src/client/views/Main.tsx @@ -146,9 +146,9 @@ export class Main extends React.Component { @action createNewWorkspace = async (id?: string) => { - const list = Cast(CurrentUserUtils.UserDocument.workspaces, listSpec(Doc)); + const list = Cast(CurrentUserUtils.UserDocument.data, listSpec(Doc)); if (list) { - let freeformDoc = Docs.FreeformDocument([], { x: 0, y: 400, title: "mini collection" }); + let freeformDoc = Docs.FreeformDocument([], { x: 0, y: 400, title: `WS collection ${list.length + 1}` }); var dockingLayout = { content: [{ type: 'row', content: [CollectionDockingView.makeDocumentConfig(freeformDoc)] }] }; let mainDoc = Docs.DockDocument([freeformDoc], JSON.stringify(dockingLayout), { title: `Workspace ${list.length + 1}` }); list.push(mainDoc); @@ -219,7 +219,7 @@ export class Main extends React.Component { let addTextNode = action(() => Docs.TextDocument({ borderRounding: -1, width: 200, height: 200, title: "a text note" })); let addColNode = action(() => Docs.FreeformDocument([], { width: 200, height: 200, title: "a freeform collection" })); let addSchemaNode = action(() => Docs.SchemaDocument([], { width: 200, height: 200, title: "a schema collection" })); - let addTreeNode = action(() => Docs.TreeDocument([this.mainContainer!], { width: 250, height: 400, title: "Library:" + StrCast(this.mainContainer!.title), copyDraggedItems: true })); + let addTreeNode = action(() => Docs.TreeDocument([CurrentUserUtils.UserDocument], { width: 250, height: 400, title: "Library:" + CurrentUserUtils.email, copyDraggedItems: true })); // let addTreeNode = action(() => Docs.TreeDocument(this._northstarSchemas, { width: 250, height: 400, title: "northstar schemas", copyDraggedItems: true })); let addVideoNode = action(() => Docs.VideoDocument(videourl, { width: 200, title: "video node" })); let addPDFNode = action(() => Docs.PdfDocument(pdfurl, { width: 200, height: 200, title: "a pdf doc" })); @@ -281,7 +281,7 @@ export class Main extends React.Component { get workspaceMenu() { let areWorkspacesShown = () => this._workspacesShown; let toggleWorkspaces = () => runInAction(() => this._workspacesShown = !this._workspacesShown); - let workspaces = Cast(CurrentUserUtils.UserDocument.workspaces, listSpec(Doc)); + let workspaces = Cast(CurrentUserUtils.UserDocument.data, listSpec(Doc)); return (!workspaces || !this.mainContainer) ? (null) : <WorkspacesMenu active={this.mainContainer} open={this.openWorkspace} new={this.createNewWorkspace} allWorkspaces={workspaces} diff --git a/src/server/authentication/models/current_user_utils.ts b/src/server/authentication/models/current_user_utils.ts index 30a8980ae..9db470ca0 100644 --- a/src/server/authentication/models/current_user_utils.ts +++ b/src/server/authentication/models/current_user_utils.ts @@ -23,7 +23,8 @@ export class CurrentUserUtils { private static createUserDocument(id: string): Doc { let doc = new Doc(id, true); - doc.workspaces = new List<Doc>(); + doc.title = this.email; + doc.data = new List<Doc>(); doc.optionalRightCollection = Docs.SchemaDocument([], { title: "Pending documents" }); return doc; } |