mirror of
https://github.com/filecoin-project/slate.git
synced 2024-12-24 01:23:08 +03:00
slates: adds the slates a user makes to the side navigation
This commit is contained in:
parent
fb54a1429d
commit
41b019aaeb
@ -38,7 +38,18 @@ const constructFilesTreeForNavigation = (library) => {
|
||||
return library;
|
||||
};
|
||||
|
||||
export const generate = (library) => [
|
||||
const constructSlatesTreeForNavigation = (slates) => {
|
||||
return slates.map((s) => {
|
||||
return {
|
||||
...s,
|
||||
name: s.slatename,
|
||||
pageTitle: `Viewing ${s.slatename}`,
|
||||
decorator: "SLATE",
|
||||
};
|
||||
});
|
||||
};
|
||||
|
||||
export const generate = ({ library = [], slates = [] }) => [
|
||||
{
|
||||
id: 1,
|
||||
name: "Home",
|
||||
@ -66,7 +77,7 @@ export const generate = (library) => [
|
||||
name: "Slates",
|
||||
pageTitle: "Your slates",
|
||||
decorator: "SLATES",
|
||||
children: [],
|
||||
children: constructSlatesTreeForNavigation(slates),
|
||||
},
|
||||
// TODO(colin):
|
||||
// re-enable this when we do local offline.
|
||||
|
@ -23,6 +23,7 @@ const IconMap = {
|
||||
MINERS: <SVG.Miners height="20px" />,
|
||||
STORAGE_MARKET: <SVG.StorageMarket height="20px" />,
|
||||
SLATES: <SVG.Slates height="20px" />,
|
||||
SLATE: <SVG.Slates height="20px" />,
|
||||
LOCAL_DATA: <SVG.HardDrive height="20px" />,
|
||||
PROFILE_PAGE: <SVG.ProfileUser height="20px" />,
|
||||
};
|
||||
|
@ -390,6 +390,7 @@ export default class ApplicationPage extends React.Component {
|
||||
};
|
||||
|
||||
render() {
|
||||
// NOTE(jim): Not authenticated.
|
||||
if (!this.state.viewer) {
|
||||
return (
|
||||
<WebsitePrototypeWrapper
|
||||
@ -405,7 +406,8 @@ export default class ApplicationPage extends React.Component {
|
||||
);
|
||||
}
|
||||
|
||||
const navigation = NavigationData.generate(this.state.viewer.library);
|
||||
// NOTE(jim): Authenticated.
|
||||
const navigation = NavigationData.generate(this.state.viewer);
|
||||
const next = this.state.history[this.state.currentIndex];
|
||||
const current = NavigationData.getCurrentById(navigation, next.id);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user