From 7ef50f0ec749d9448d5eece76ec22f0a62945724 Mon Sep 17 00:00:00 2001 From: Peli de Halleux Date: Tue, 21 Apr 2015 12:25:27 -0700 Subject: [PATCH] added hub silo to list / create lists --- editor/hub.ts | 43 ++++++++++++++++++++-------------- editor/scriptList.ts | 55 ++++++++++++++++++++++++++++++++++++++++---- rt/ticker.ts | 2 ++ 3 files changed, 79 insertions(+), 21 deletions(-) diff --git a/editor/hub.ts b/editor/hub.ts index 758b4a0e..8111d810 100644 --- a/editor/hub.ts +++ b/editor/hub.ts @@ -1205,11 +1205,11 @@ module TDev.Browser { this.hide(); if (s == "recent") this.browser().showList("installed-scripts", item); else if (s == "myart") { - if (Cloud.getUserId()) - this.browser().showList("myart", item); + if (Cloud.getUserId()) this.browser().showList("myart", item); } else if (s == "art") this.browser().showList("art", item); else if (s == "social") this.browser().showList("groups", item); else if (s == "users") this.browser().showList("users", item); + else if (s == "lists") this.browser().showList("lists", item); else this.browser().showList(s + "-scripts", item); }); elements.push(t); @@ -1305,17 +1305,24 @@ module TDev.Browser { addFnBtn(lf("Upload Sound"), Ticks.hubUploadSound, () => { ArtUtil.uploadSoundDialogAsync().done() }, true); } else if (s == "social") { - addFnBtn(lf("All my groups"), Ticks.hubSeeMoreGroups, () => { this.hide(); this.browser().showList("mygroups", null) }); - elements.peek().appendChild(div("hubTileSearch", HTML.mkImg("svg:search,white"))); + addFnBtn(lf("All my groups"), Ticks.hubSeeMoreGroups,() => { this.hide(); this.browser().showList("mygroups", null) }); + elements.peek().appendChild(div("hubTileSearch", HTML.mkImg("svg:search,white"))); - if (!this.isBeginner()) { - elements.push(this.smallBtn(lf("Users"), () => { this.hide(); this.browser().showList("users", null) }, Ticks.hubSeeMoreUsers)); - elements.push(this.smallBtn(lf("Give feedback Contact us"), () => { Editor.showFeedbackBox() }, Ticks.hubFeedback)); - elements.push(this.smallBtn(lf("Join Group"), () => { this.joinGroup() }, Ticks.hubJoinGroup)); - elements.push(this.smallBtn(lf("Create Group"), () => { this.createGroup() }, Ticks.hubCreateGroup)); - } else { - elements.push(this.mkFnBtn(lf("Join Group"), () => { this.joinGroup() }, Ticks.hubJoinGroup)); - } + if (!this.isBeginner()) { + elements.push(this.smallBtn(lf("Users"),() => { this.hide(); this.browser().showList("users", null) }, Ticks.hubSeeMoreUsers)); + elements.push(this.smallBtn(lf("Give feedback Contact us"),() => { Editor.showFeedbackBox() }, Ticks.hubFeedback)); + elements.push(this.smallBtn(lf("Join Group"),() => { this.joinGroup() }, Ticks.hubJoinGroup)); + elements.push(this.smallBtn(lf("Create Group"),() => { this.createGroup() }, Ticks.hubCreateGroup)); + } else { + elements.push(this.mkFnBtn(lf("Join Group"),() => { this.joinGroup() }, Ticks.hubJoinGroup)); + } + } else if (s == "lists") { + addFnBtn(lf("See More"), Ticks.hubSeeMoreLists, + () => { this.hide(); this.browser().showList("lists", null) }); + elements.peek().appendChild(div("hubTileSearch", HTML.mkImg("svg:search,white"))); + addFnBtn(lf("Create list"), Ticks.hubCreateList, + () => { this.createList(); }); + elements.peek().appendChild(div("hubTileSearch", HTML.mkImg("svg:script,white"))); } else { //if (items.length > 5) // there is almost always more; the list will filter by capabilities, so it may seem short @@ -1330,11 +1337,6 @@ module TDev.Browser { addFnBtn(lf("New Scripts"), Ticks.hubSeeMoreNewScripts, () => { this.hide(); this.browser().showList("new-scripts", null) }); elements.peek().appendChild(div("hubTileSearch", HTML.mkImg("svg:star,white"))); - if (Cloud.lite) { - addFnBtn(lf("Create list"), Ticks.hubCreateList, - () => { this.createList(); }); - elements.peek().appendChild(div("hubTileSearch", HTML.mkImg("svg:script,white"))); - } } } @@ -2146,6 +2148,7 @@ module TDev.Browser { } if (Cloud.lite) { delete sects["tags"]; + sects["lists"] = lf("lists") } if (SizeMgr.portraitMode) { @@ -2272,6 +2275,12 @@ module TDev.Browser { else this.addPageTiles(s, c, []); } + else if (s == "lists") { + if (Cloud.getUserId()) + this.browser().getLocationList(Cloud.getUserId() + "/lists?count=6",(items, cont) => this.addPageTiles(s, c, items)); + else + this.addPageTiles(s, c, []); + } else this.browser().getLocationList(s + "-scripts", (items, cont) => this.addPageTiles(s, c, items)); }); diff --git a/editor/scriptList.ts b/editor/scriptList.ts index 432cdcb8..f075e317 100644 --- a/editor/scriptList.ts +++ b/editor/scriptList.ts @@ -1395,7 +1395,10 @@ tick(Ticks.browseListUsers); header = lf("users"); break; - + case "lists": + tick(Ticks.browseListLists); + header = lf("lists"); + break; default: if (/^bugs\//.test(path)) { tick(Ticks.browseListBugs); @@ -5925,11 +5928,12 @@ //nums.style.background = this.app.htmlColor(); var smallIcon = div("hubTileSmallIcon"); - var bigIcon = div("hubTileScreenShot"); + var bigIcon = null; var ss = this.jsonScript.screenshotthumburl || ArtUtil.artUrl(this.app.iconArtId); if (ss && !Browser.lowMemory) { ss = ss.replace(/\/thumb\//, "/pub/"); + bigIcon = div("hubTileScreenShot"); bigIcon.style.backgroundImage = HTML.cssImage(ss); bigIcon.style.backgroundRepeat = 'no-repeat'; bigIcon.style.backgroundPosition = 'center'; @@ -9245,7 +9249,7 @@ this.publicId = id; } - public mkBoxCore(big: boolean) { + public mkBoxCore(big: boolean) : HTMLElement { var icon = div("sdIcon", HTML.mkImg("svg:script,white")); icon.style.background = "#1731B8"; var nameBlock = div("sdName"); @@ -9269,7 +9273,7 @@ return this.withUpdate(res,(u: JsonPubList) => { this.json = u; if (u.pictureid && !Browser.lowMemory) { - icon.style.backgroundImage = HTML.cssImage('https://az31353.vo.msecnd.net/pub/' + u.pictureid); + icon.style.backgroundImage = HTML.cssImage(ArtUtil.artUrl(u.pictureid)); icon.style.backgroundRepeat = 'no-repeat'; icon.style.backgroundPosition = 'center'; icon.style.backgroundSize = 'contain'; @@ -9281,6 +9285,49 @@ }); } + public mkTile(sz: number) : HTMLElement { + var d = div("hubTile hubTileSize" + sz); + d.style.background = "#1731B8"; + return this.withUpdate(d, (u: JsonPubList) => { + this.json = u; + + var cont = []; + var addNum = (n: number, sym: string) => { cont.push(ScriptInfo.mkNum(n, sym)) } + addNum(this.json.positivereviews, "♥"); + if (sz > 1) { + addNum(this.json.comments, "✉"); + } + + var nums = div("hubTileNumbers", cont, div("hubTileNumbersOverlay")); + //nums.style.background = this.app.htmlColor(); + + var smallIcon = div("hubTileSmallIcon"); + var bigIcon = null; + + if (this.json.pictureid && !Browser.lowMemory) { + bigIcon = div("hubTileScreenShot"); + bigIcon.style.backgroundImage = HTML.cssImage(ArtUtil.artUrl(this.json.pictureid)); + bigIcon.style.backgroundRepeat = 'no-repeat'; + bigIcon.style.backgroundPosition = 'center'; + bigIcon.style.backgroundSize = 'cover'; + smallIcon.setChildren([HTML.mkImg("svg:script")]); + smallIcon.style.background = "#1731B8"; + } + + d.setChildren([div("hubTileIcon", HTML.mkImg("svg:script,white")), + bigIcon, + smallIcon, + div("hubTileTitleBar", + div("hubTileTitle", spanDirAuto(this.json.name)), + div("hubTileSubtitle", + div("hubTileAuthor", spanDirAuto(this.json.username), nums)))]) + }); + } + + public mkTabsCore(): BrowserTab[]{ + return [this]; + } + public initTab() { // TODO: display scripts } diff --git a/rt/ticker.ts b/rt/ticker.ts index 28af4b7d..0354c1d2 100644 --- a/rt/ticker.ts +++ b/rt/ticker.ts @@ -371,6 +371,7 @@ module TDev { hubSeeMoreDocs, hubSeeMoreCloud, hubSeeMoreGroups, + hubSeeMoreLists, hubMyScriptsShowcase, hubMyScriptsTemplate, hubNotifications, @@ -440,6 +441,7 @@ module TDev { browseListTags, browseListSearch, browseListUsers, + browseListLists, browseFollowTopic, introSlideGetStarted,