2020-08-02 10:55:55 +03:00
|
|
|
import * as Strings from "~/common/strings";
|
|
|
|
|
2020-08-18 22:41:41 +03:00
|
|
|
// NOTE(jim):
|
|
|
|
// Recursion for nested entities (any number).
|
2021-02-19 11:17:19 +03:00
|
|
|
export const getCurrent = ({ id, data }) => {
|
2020-07-27 06:39:07 +03:00
|
|
|
let target = null;
|
|
|
|
let activeIds = {};
|
|
|
|
|
|
|
|
const findById = (state, id) => {
|
|
|
|
for (let i = 0; i < state.length; i++) {
|
|
|
|
if (state[i].id === id) {
|
|
|
|
target = state[i];
|
|
|
|
activeIds[state[i].id] = true;
|
2021-02-19 11:17:19 +03:00
|
|
|
|
|
|
|
if (target.id === "NAV_SLATE") {
|
2021-02-19 11:21:35 +03:00
|
|
|
target.slateId = data && data.id;
|
2021-02-19 11:17:19 +03:00
|
|
|
}
|
2020-07-27 06:39:07 +03:00
|
|
|
}
|
|
|
|
|
2021-01-15 02:42:07 +03:00
|
|
|
// if (!target && state[i].children) {
|
|
|
|
// activeIds[state[i].id] = true;
|
|
|
|
// findById(state[i].children, id);
|
2020-07-27 06:39:07 +03:00
|
|
|
|
2021-01-15 02:42:07 +03:00
|
|
|
// if (!target) {
|
|
|
|
// activeIds[state[i].id] = false;
|
|
|
|
// }
|
|
|
|
// }
|
2020-04-09 00:29:13 +03:00
|
|
|
}
|
2020-07-27 06:39:07 +03:00
|
|
|
};
|
|
|
|
|
2021-02-19 11:17:19 +03:00
|
|
|
findById(navigation, id);
|
2020-07-27 06:39:07 +03:00
|
|
|
|
|
|
|
return { target, activeIds };
|
|
|
|
};
|
|
|
|
|
2021-01-15 02:42:07 +03:00
|
|
|
export const navigation = [
|
|
|
|
{
|
2020-12-19 08:25:50 +03:00
|
|
|
id: "NAV_DATA",
|
|
|
|
decorator: "DATA",
|
|
|
|
name: "Home",
|
2021-01-15 02:42:07 +03:00
|
|
|
pageTitle: "Welcome back!",
|
|
|
|
},
|
2020-04-09 00:29:13 +03:00
|
|
|
{
|
2020-12-19 08:25:50 +03:00
|
|
|
id: "NAV_ACTIVITY",
|
|
|
|
decorator: "ACTIVITY",
|
|
|
|
name: "Activity",
|
2021-02-22 15:57:04 +03:00
|
|
|
pageTitle: "Activity",
|
2020-12-19 08:25:50 +03:00
|
|
|
ignore: true,
|
2021-01-14 09:30:26 +03:00
|
|
|
},
|
|
|
|
{
|
|
|
|
id: "NAV_EXPLORE",
|
|
|
|
decorator: "EXPLORE",
|
|
|
|
name: "Explore",
|
|
|
|
pageTitle: "Welcome back!",
|
|
|
|
ignore: true,
|
2020-04-09 00:29:13 +03:00
|
|
|
},
|
2020-07-16 04:36:29 +03:00
|
|
|
{
|
2020-12-19 08:25:50 +03:00
|
|
|
id: "NAV_SLATES",
|
2020-08-18 22:43:41 +03:00
|
|
|
decorator: "SLATES",
|
2020-07-16 04:36:29 +03:00
|
|
|
name: "Slates",
|
2020-07-29 02:24:15 +03:00
|
|
|
pageTitle: "Slates",
|
2020-12-18 00:49:39 +03:00
|
|
|
ignore: true,
|
2020-07-16 04:36:29 +03:00
|
|
|
},
|
2020-12-18 05:59:41 +03:00
|
|
|
{
|
2020-12-19 08:25:50 +03:00
|
|
|
id: "NAV_SLATES_FOLLOWING",
|
2020-12-18 05:59:41 +03:00
|
|
|
decorator: "SLATES_FOLLOWING",
|
|
|
|
name: "Slates",
|
|
|
|
pageTitle: "Slates",
|
|
|
|
ignore: true,
|
|
|
|
},
|
2020-12-09 07:22:17 +03:00
|
|
|
{
|
2020-12-19 08:25:50 +03:00
|
|
|
id: "NAV_DIRECTORY",
|
2020-12-09 07:22:17 +03:00
|
|
|
decorator: "DIRECTORY",
|
|
|
|
name: "Directory",
|
|
|
|
pageTitle: "Your directory",
|
|
|
|
},
|
2020-12-18 05:59:41 +03:00
|
|
|
{
|
2020-12-19 08:25:50 +03:00
|
|
|
id: "NAV_DIRECTORY_FOLLOWERS",
|
2020-12-18 05:59:41 +03:00
|
|
|
decorator: "DIRECTORY_FOLLOWERS",
|
|
|
|
name: "Directory",
|
|
|
|
pageTitle: "Your directory",
|
|
|
|
ignore: true,
|
|
|
|
},
|
2020-08-31 21:19:46 +03:00
|
|
|
{
|
2020-12-19 08:25:50 +03:00
|
|
|
id: "NAV_SLATE",
|
|
|
|
decorator: "SLATE",
|
2020-08-31 21:19:46 +03:00
|
|
|
name: "Slate",
|
|
|
|
pageTitle: "Slate",
|
|
|
|
ignore: true,
|
|
|
|
},
|
2020-08-25 05:31:42 +03:00
|
|
|
/*
|
2020-04-09 00:29:13 +03:00
|
|
|
{
|
2020-08-18 22:28:33 +03:00
|
|
|
id: "V1_NAVIGATION_LOCAL",
|
2020-08-18 22:43:41 +03:00
|
|
|
decorator: "LOCAL_DATA",
|
2020-08-08 03:15:49 +03:00
|
|
|
name: "Local",
|
2020-08-18 22:41:41 +03:00
|
|
|
pageTitle: "Your local data",
|
2020-08-08 03:15:49 +03:00
|
|
|
children: [],
|
|
|
|
ignore: false,
|
2020-04-09 00:29:13 +03:00
|
|
|
},
|
2020-08-18 22:41:41 +03:00
|
|
|
{
|
|
|
|
id: "V1_NAVIGATION_NETWORK",
|
2020-08-18 22:43:41 +03:00
|
|
|
decorator: "NETWORK",
|
2020-08-18 22:41:41 +03:00
|
|
|
name: "Network",
|
|
|
|
pageTitle: "The Filecoin Network",
|
|
|
|
children: null,
|
|
|
|
},
|
2020-08-25 05:31:42 +03:00
|
|
|
*/
|
2020-09-09 20:56:35 +03:00
|
|
|
{
|
2020-12-19 08:25:50 +03:00
|
|
|
id: "NAV_FILECOIN",
|
2020-09-09 20:56:35 +03:00
|
|
|
decorator: "FILECOIN",
|
2020-09-23 05:35:56 +03:00
|
|
|
name: "Filecoin",
|
2020-09-09 20:56:35 +03:00
|
|
|
pageTitle: "Archive on Filecoin",
|
2020-09-25 10:08:08 +03:00
|
|
|
filecoin: true,
|
2020-08-08 03:15:49 +03:00
|
|
|
},
|
2020-11-16 05:14:14 +03:00
|
|
|
{
|
2020-12-19 08:25:50 +03:00
|
|
|
id: "NAV_STORAGE_DEAL",
|
|
|
|
decorator: "STORAGE_DEAL",
|
2020-11-16 05:14:14 +03:00
|
|
|
name: "Storage Deal",
|
|
|
|
filecoin: true,
|
2021-01-21 22:20:13 +03:00
|
|
|
pageTitle: "Make a one-off Filecoin storage deal",
|
2020-11-16 05:14:14 +03:00
|
|
|
},
|
2020-09-23 01:01:36 +03:00
|
|
|
{
|
2020-12-19 08:25:50 +03:00
|
|
|
id: "NAV_API",
|
|
|
|
decorator: "API",
|
2020-11-16 00:54:14 +03:00
|
|
|
name: "API",
|
|
|
|
pageTitle: "Developer API",
|
2020-09-23 05:39:46 +03:00
|
|
|
},
|
2020-08-08 03:15:49 +03:00
|
|
|
{
|
2020-12-19 08:25:50 +03:00
|
|
|
id: "NAV_SETTINGS",
|
|
|
|
decorator: "SETTINGS",
|
2020-08-08 03:15:49 +03:00
|
|
|
name: "Profile & Account Settings",
|
|
|
|
pageTitle: "Your Profile & Account Settings",
|
|
|
|
ignore: true,
|
|
|
|
},
|
2021-01-24 04:18:04 +03:00
|
|
|
{
|
|
|
|
id: "NAV_PROFILE_FILES",
|
|
|
|
decorator: "PROFILE_FILES",
|
|
|
|
name: "Profile",
|
|
|
|
pageTitle: "Profile",
|
|
|
|
ignore: true,
|
|
|
|
},
|
2020-08-31 21:19:46 +03:00
|
|
|
{
|
2020-12-19 08:25:50 +03:00
|
|
|
id: "NAV_PROFILE",
|
2020-12-20 05:19:32 +03:00
|
|
|
decorator: "PROFILE",
|
2020-08-31 21:19:46 +03:00
|
|
|
name: "Profile",
|
|
|
|
pageTitle: "Profile",
|
|
|
|
ignore: true,
|
|
|
|
},
|
2021-01-24 04:18:04 +03:00
|
|
|
{
|
|
|
|
id: "NAV_PROFILE_PEERS",
|
|
|
|
decorator: "PROFILE_PEERS",
|
|
|
|
name: "Profile",
|
|
|
|
pageTitle: "Profile",
|
|
|
|
ignore: true,
|
|
|
|
},
|
2020-08-31 21:19:46 +03:00
|
|
|
{
|
2020-12-19 08:25:50 +03:00
|
|
|
id: "NAV_FILE",
|
2020-08-31 21:19:46 +03:00
|
|
|
decorator: "FILE",
|
|
|
|
name: "File",
|
|
|
|
pageTitle: "File",
|
|
|
|
ignore: true,
|
|
|
|
},
|
2020-04-09 00:29:13 +03:00
|
|
|
];
|