urbit/pkg/interface/.storybook/preview.js

265 lines
7.7 KiB
JavaScript
Raw Normal View History

import React from "react";
import dark from "@tlon/indigo-dark";
import light from "@tlon/indigo-light";
import { Reset } from "@tlon/indigo-react";
import { BrowserRouter } from "react-router-dom";
import { ThemeProvider } from "styled-components";
import useGraphState from "~/logic/state/graph";
import useGroupState from "~/logic/state/group";
import useMetadataState from "~/logic/state/metadata";
import useContactState from "~/logic/state/contact";
import "~/views/landscape/css/custom.css";
import "~/views/css/fonts.css";
import "~/views/apps/chat/css/custom.css";
import "~/views/css/indigo-static.css";
2021-05-19 04:55:23 +03:00
export const parameters = {
actions: { argTypesRegex: "^on[A-Z].*" },
2021-05-19 04:55:23 +03:00
controls: {
matchers: {
color: /(background|color)$/i,
date: /Date$/,
},
},
};
const groupPreview = {
group: "/ship/~bollug-worlus/urbit-index",
channels: {
"/ship/~darrux-landes/index-weekly": {
metadata: {
preview: false,
vip: "",
title: "Index Weekly",
description: "A weekly roundup of content from around the network",
creator: "~bollug-worlus",
picture: "",
hidden: false,
config: {
graph: "publish",
},
"date-created": "~2020.4.6..21.53.30..dc68",
color: "0x0",
},
"app-name": "graph",
resource: "/ship/~bollug-worlus/index-weekly",
group: "/ship/~bollug-worlus/urbit-index",
},
},
members: 1237,
"channel-count": 3,
metadata: {
preview: false,
vip: "",
title: "Urbit Index",
description: "A weekly roundup of content form around the network",
creator: "~bollug-worlus",
picture: "",
hidden: false,
config: {
group: null,
},
"date-created": "~2020.4.6..21.53.30..dc68",
color: "0x0",
},
};
const groupPending = (progress) => ({
hidden: false,
started: Date.now() - 3600,
ship: "~bollug-worlus",
progress,
shareContact: false,
autojoin: false,
app: "groups",
invite: [],
});
2021-05-19 04:55:23 +03:00
export const globalTypes = {
theme: {
name: "Theme",
description: "Global Theme for components",
defaultValue: "light",
2021-05-19 04:55:23 +03:00
toolbar: {
icon: "circlehollow",
items: ["light", "dark"],
2021-05-19 04:55:23 +03:00
},
},
};
export const decorators = [
(Story, context) => {
window.ship = "sampel-palnet";
const theme = context.globals.theme === "light" ? light : dark;
2021-05-19 04:55:23 +03:00
useContactState.setState({
contacts: {
"~ridlur-figbud": {
status: "please like and subscribe",
"last-updated": 1616609090555,
avatar: null,
cover: null,
bio: "",
nickname: "Gav",
color: "0x26.3e0f",
groups: [],
},
"~sampel-palnet": {
status: "A test status",
"last-updated": 1616609090555,
avatar: null,
cover: null,
bio: "",
nickname: "You",
color: "0x26.3e0f",
groups: [],
2021-07-06 07:31:09 +03:00
},
},
});
useGroupState.setState({
pendingJoin: {
"/ship/~bollug-worlus/urbit-index-start": groupPending("start"),
"/ship/~bollug-worlus/urbit-index-metadata": groupPending("metadata"),
"/ship/~bollug-worlus/urbit-index-done": groupPending("done"),
"/ship/~bollug-worlus/urbit-index-error": groupPending("no-perms"),
},
});
2021-05-19 04:55:23 +03:00
useMetadataState.setState({
associations: {
groups: {
"/ship/~bitbet-bolbel/urbit-community": {
2021-05-19 04:55:23 +03:00
metadata: {
preview: false,
vip: "",
title: "Urbit Community",
description: "World hub, help desk, meet and greet, etc.",
creator: "~bitbet-bolbel",
2021-05-19 04:55:23 +03:00
picture:
"https://fabled-faster.nyc3.digitaloceanspaces.com/fabled-faster/2021.4.02..21.52.41-UC.png",
2021-05-19 04:55:23 +03:00
hidden: false,
config: {
group: {
"app-name": "graph",
resource: "/ship/~bitbet-bolbel/urbit-community-5.963",
2021-05-19 04:55:23 +03:00
},
},
"date-created": "~2020.6.25..21.39.35..2fd2",
color: "0x8f.9c9d",
2021-05-19 04:55:23 +03:00
},
"app-name": "groups",
resource: "/ship/~bitbet-bolbel/urbit-community",
group: "/ship/~bitbet-bolbel/urbit-community",
2021-05-19 04:55:23 +03:00
},
},
graph: {
"/ship/~bitbet-bolbel/links": {
metadata: {
preview: false,
vip: "",
title: "Link Collection",
description: "",
creator: "~darrux-landes",
picture: "",
hidden: false,
config: {
graph: "link",
},
"date-created": "~2020.4.6..21.53.30..dc68",
color: "0x0",
},
"app-name": "graph",
resource: "/ship/~bitbet-bolbel/links",
group: "/ship/~bitbet-bolbel/urbit-community",
},
"/ship/~darrux-landes/development": {
2021-05-19 04:55:23 +03:00
metadata: {
preview: false,
vip: "",
title: "Development",
2021-05-19 04:55:23 +03:00
description:
"Urbit Development Mailing List: https://groups.google.com/a/urbit.org/forum/#!forum/dev",
creator: "~darrux-landes",
picture: "",
2021-05-19 04:55:23 +03:00
hidden: false,
config: {
graph: "chat",
2021-05-19 04:55:23 +03:00
},
"date-created": "~2020.4.6..21.53.30..dc68",
color: "0x0",
2021-05-19 04:55:23 +03:00
},
"app-name": "graph",
resource: "/ship/~darrux-landes/development",
group: "/ship/~bitbet-bolbel/urbit-community",
2021-05-19 04:55:23 +03:00
},
},
},
2021-07-06 07:31:09 +03:00
previews: {
"/ship/~bollug-worlus/urbit-index": groupPreview,
"/ship/~bollug-worlus/urbit-index-start": groupPreview,
"/ship/~bollug-worlus/urbit-index-metadata": groupPreview,
"/ship/~bollug-worlus/urbit-index-done": groupPreview,
"/ship/~bollug-worlus/urbit-index-error": groupPreview,
2021-07-06 07:31:09 +03:00
},
2021-05-19 04:55:23 +03:00
});
2021-05-25 07:42:40 +03:00
useContactState.setState({
contacts: {
"~sampel-palnet": {
status: "Just urbiting",
"last-updated": 1621511447583,
2021-05-25 07:42:40 +03:00
avatar: null,
cover: null,
bio: "An urbit user",
nickname: "Sample Planet",
color: "0xee.5432",
2021-05-25 07:42:40 +03:00
groups: [],
},
},
});
2021-05-19 04:55:23 +03:00
useGraphState.setState({
looseNodes: {
"darrux-landes/development": {
"/170141184505059416342852185329797955584": {
2021-05-19 04:55:23 +03:00
post: {
index: "/170141184505059416342852185329797955584",
author: "sipfyn-pidmex",
"time-sent": 1621275183241,
2021-05-19 04:55:23 +03:00
signatures: [
{
signature:
"0x3.9e41.4f04.3cac.786e.30c1.f4cc.8db3.9a78.0401.d16f.6301.94d0.a08a.0695.5008.02bf.0e07.a7a9.3d87.85f7.6334.e598.4ed3.5dee.58a7.cbd3.30e6.d65b.1fc9.ac62.162a.daf0.ff14.9cca.4a93.8177.0755.7b74.9d52.c0a6.b27f.9001",
2021-05-19 04:55:23 +03:00
life: 2,
ship: "sipfyn-pidmex",
2021-05-19 04:55:23 +03:00
},
],
contents: [
{
text:
"is there a way to get a bunt of a specific instantance of a tagged union? i.e. if you have `$%([%a =atom] [%b =cell])`, can you get a bunt of specifically subtype `%a`?",
2021-05-19 04:55:23 +03:00
},
],
hash: "0xe790.53c1.0f2b.1e1b.8c30.7d33.236c.e69e",
2021-05-19 04:55:23 +03:00
},
children: {
root: {},
cachedIter: null,
},
},
},
},
});
return (
<ThemeProvider theme={theme}>
<BrowserRouter>
<Story />
<div id="portal-root" />
</BrowserRouter>
</ThemeProvider>
);
},
];