From 97e1fa12a98cec91a7a12b590d75a74f5e0c99fa Mon Sep 17 00:00:00 2001 From: Logan Allen Date: Tue, 6 Oct 2020 13:04:17 -0500 Subject: [PATCH] interface: removed unused links files --- pkg/interface/src/logic/lib/util.js | 23 -- .../src/views/apps/links/LinkResource.tsx | 13 +- pkg/interface/src/views/apps/links/app.js | 227 ------------------ .../components/{lib => }/comment-item.js | 0 .../components/{lib => }/comment-submit.js | 0 .../links/components/{lib => }/comments.js | 0 .../apps/links/components/lib/channel-item.js | 29 --- .../links/components/lib/channel-sidebar.js | 109 --------- .../apps/links/components/lib/group-item.js | 43 ---- .../links/components/lib/member-element.js | 55 ----- .../links/components/lib/message-screen.js | 15 -- .../apps/links/components/lib/pagination.js | 37 --- .../apps/links/components/lib/welcome.js | 41 ---- .../apps/links/components/link-detail.js | 100 -------- .../links/components/{lib => }/link-item.js | 2 +- .../views/apps/links/components/link-list.js | 91 ------- .../components/{lib => }/link-preview.js | 0 .../components/{lib => }/link-submit.tsx | 0 .../views/apps/links/components/loading.js | 8 - .../src/views/apps/links/components/new.tsx | 105 -------- .../views/apps/links/components/settings.js | 184 -------------- .../views/apps/links/components/skeleton.js | 36 --- .../src/views/components/chat-link-tabbar.js | 30 --- 23 files changed, 7 insertions(+), 1141 deletions(-) delete mode 100644 pkg/interface/src/views/apps/links/app.js rename pkg/interface/src/views/apps/links/components/{lib => }/comment-item.js (100%) rename pkg/interface/src/views/apps/links/components/{lib => }/comment-submit.js (100%) rename pkg/interface/src/views/apps/links/components/{lib => }/comments.js (100%) delete mode 100644 pkg/interface/src/views/apps/links/components/lib/channel-item.js delete mode 100644 pkg/interface/src/views/apps/links/components/lib/channel-sidebar.js delete mode 100644 pkg/interface/src/views/apps/links/components/lib/group-item.js delete mode 100644 pkg/interface/src/views/apps/links/components/lib/member-element.js delete mode 100644 pkg/interface/src/views/apps/links/components/lib/message-screen.js delete mode 100644 pkg/interface/src/views/apps/links/components/lib/pagination.js delete mode 100644 pkg/interface/src/views/apps/links/components/lib/welcome.js delete mode 100644 pkg/interface/src/views/apps/links/components/link-detail.js rename pkg/interface/src/views/apps/links/components/{lib => }/link-item.js (97%) delete mode 100644 pkg/interface/src/views/apps/links/components/link-list.js rename pkg/interface/src/views/apps/links/components/{lib => }/link-preview.js (100%) rename pkg/interface/src/views/apps/links/components/{lib => }/link-submit.tsx (100%) delete mode 100644 pkg/interface/src/views/apps/links/components/loading.js delete mode 100644 pkg/interface/src/views/apps/links/components/new.tsx delete mode 100644 pkg/interface/src/views/apps/links/components/settings.js delete mode 100644 pkg/interface/src/views/apps/links/components/skeleton.js delete mode 100644 pkg/interface/src/views/components/chat-link-tabbar.js diff --git a/pkg/interface/src/logic/lib/util.js b/pkg/interface/src/logic/lib/util.js index 48dea0f037..aacefcd208 100644 --- a/pkg/interface/src/logic/lib/util.js +++ b/pkg/interface/src/logic/lib/util.js @@ -232,29 +232,6 @@ export function stringToTa(string) { return '~.' + out; } -// used in Links - -export function makeRoutePath( - resource, - page = 0, - url = null, - index = 0, - compage = 0 -) { - let route = '/~link' + resource; - if (!url) { - if (page !== 0) { - route = route + '/' + page; - } - } else { - route = `${route}/${page}/${index}/${base64urlEncode(url)}`; - if (compage !== 0) { - route = route + '/' + compage; - } - } - return route; -} - export function amOwnerOfGroup(groupPath) { if (!groupPath) return false; diff --git a/pkg/interface/src/views/apps/links/LinkResource.tsx b/pkg/interface/src/views/apps/links/LinkResource.tsx index 30ba01a25e..fbbd80f576 100644 --- a/pkg/interface/src/views/apps/links/LinkResource.tsx +++ b/pkg/interface/src/views/apps/links/LinkResource.tsx @@ -7,14 +7,13 @@ import { StoreState } from "~/logic/store/type"; import { uxToHex } from '~/logic/lib/util'; import { Association, GraphNode } from "~/types"; import { RouteComponentProps } from "react-router-dom"; -import { LinkList } from "./components/link-list"; -import { LinkDetail } from "./components/link-detail"; -import { LinkItem } from "./components/lib/link-item"; -import { LinkSubmit } from "./components/lib/link-submit"; -import { LinkPreview } from "./components/lib/link-preview"; -import { CommentSubmit } from "./components/lib/comment-submit"; -import { Comments } from "./components/lib/comments"; +import { LinkItem } from "./components/link-item"; +import { LinkSubmit } from "./components/link-submit"; +import { LinkPreview } from "./components/link-preview"; +import { CommentSubmit } from "./components/comment-submit"; +import { Comments } from "./components/comments"; + import "./css/custom.css"; type LinkResourceProps = StoreState & { diff --git a/pkg/interface/src/views/apps/links/app.js b/pkg/interface/src/views/apps/links/app.js deleted file mode 100644 index 7cff3d087e..0000000000 --- a/pkg/interface/src/views/apps/links/app.js +++ /dev/null @@ -1,227 +0,0 @@ -import React, { Component } from 'react'; -import { Switch, Route } from 'react-router-dom'; -import Helmet from 'react-helmet'; - -import _ from 'lodash'; - -import './css/custom.css'; - -import { Skeleton } from './components/skeleton'; -import { NewScreen } from './components/new'; -import { SettingsScreen } from './components/settings'; -import { MessageScreen } from './components/lib/message-screen'; -import { LinkList } from './components/link-list'; -import { LinkDetail } from './components/link-detail'; - -import { - amOwnerOfGroup, - base64urlDecode -} from '~/logic/lib/util'; - - -export default class LinksApp extends Component { - componentDidMount() { - // preload spinner asset - new Image().src = '/~landscape/img/Spinner.png'; - - this.props.subscription.startApp('graph'); - if (!this.props.sidebarShown) { - this.props.api.local.sidebarToggle(); - } - } - - componentWillUnmount() { - this.props.subscription.stopApp('graph'); - } - - render() { - const { props } = this; - const contacts = props.contacts ? props.contacts : {}; - const groups = props.groups ? props.groups : {}; - const associations = - props.associations ? props.associations : { graph: {}, contacts: {} }; - const graphKeys = props.graphKeys || new Set([]); - const graphs = props.graphs || {}; - - const invites = props.invites ? - props.invites : {}; - - const { - api, sidebarShown, s3, - hideAvatars, hideNicknames, remoteContentPolicy - } = this.props; - - return ( - <> - - OS1 - Links - - - ( - - - - )} - /> - ( - - - - )} - /> - { - const resourcePath = - `${props.match.params.ship}/${props.match.params.name}`; - const metPath = `/ship/~${resourcePath}`; - const resource = - associations.graph[metPath] ? - associations.graph[metPath] : { metadata: {} }; - - const contactDetails = contacts[resource['group-path']] || {}; - const group = groups[resource['group-path']] || new Set([]); - const amOwner = amOwnerOfGroup(resource['group-path']); - const hasGraph = !!graphs[resourcePath]; - - return ( - - - - ); - }} - /> - { - const resourcePath = - `${props.match.params.ship}/${props.match.params.name}`; - const metPath = `/ship/~${resourcePath}`; - const resource = - associations.graph[metPath] ? - associations.graph[metPath] : { metadata: {} }; - - const contactDetails = contacts[resource['group-path']] || {}; - const graph = graphs[resourcePath] || null; - - return ( - - - - ); - }} - /> - { - const resourcePath = - `${props.match.params.ship}/${props.match.params.name}`; - const metPath = `/ship/~${resourcePath}`; - const resource = - associations.graph[metPath] ? - associations.graph[metPath] : { metadata: {} }; - - const contactDetails = contacts[resource['group-path']] || {}; - - const indexArr = props.match.params.index.split('-'); - const graph = graphs[resourcePath] || null; - - if (indexArr.length <= 1) { - return
Malformed URL
; - } - - const index = parseInt(indexArr[1], 10); - const node = Boolean(graph) ? graph.get(index) : null; - - return ( - - - - ); - }} - /> -
- - ); - } -} - diff --git a/pkg/interface/src/views/apps/links/components/lib/comment-item.js b/pkg/interface/src/views/apps/links/components/comment-item.js similarity index 100% rename from pkg/interface/src/views/apps/links/components/lib/comment-item.js rename to pkg/interface/src/views/apps/links/components/comment-item.js diff --git a/pkg/interface/src/views/apps/links/components/lib/comment-submit.js b/pkg/interface/src/views/apps/links/components/comment-submit.js similarity index 100% rename from pkg/interface/src/views/apps/links/components/lib/comment-submit.js rename to pkg/interface/src/views/apps/links/components/comment-submit.js diff --git a/pkg/interface/src/views/apps/links/components/lib/comments.js b/pkg/interface/src/views/apps/links/components/comments.js similarity index 100% rename from pkg/interface/src/views/apps/links/components/lib/comments.js rename to pkg/interface/src/views/apps/links/components/comments.js diff --git a/pkg/interface/src/views/apps/links/components/lib/channel-item.js b/pkg/interface/src/views/apps/links/components/lib/channel-item.js deleted file mode 100644 index 9ed1362325..0000000000 --- a/pkg/interface/src/views/apps/links/components/lib/channel-item.js +++ /dev/null @@ -1,29 +0,0 @@ -import React, { Component } from 'react'; -import { Link } from 'react-router-dom'; - - -export class ChannelItem extends Component { - render() { - const { props } = this; - - const selectedClass = (props.selected) - ? 'bg-gray5 bg-gray1-d' - : 'pointer hover-bg-gray5 hover-bg-gray1-d'; - - const unseenCount = props.unseenCount > 0 - ? {props.unseenCount} - : null; - - return ( - -
-

{props.name}

-

- {unseenCount} -

-
- - ); - } -} - diff --git a/pkg/interface/src/views/apps/links/components/lib/channel-sidebar.js b/pkg/interface/src/views/apps/links/components/lib/channel-sidebar.js deleted file mode 100644 index c4207f302f..0000000000 --- a/pkg/interface/src/views/apps/links/components/lib/channel-sidebar.js +++ /dev/null @@ -1,109 +0,0 @@ -import React, { Component } from 'react'; - -import { Link } from 'react-router-dom'; -import { GroupItem } from './group-item'; -import SidebarInvite from '~/views/components/Sidebar/SidebarInvite'; -import { Welcome } from './welcome'; -import { alphabetiseAssociations } from '~/logic/lib/util'; - -export const ChannelSidebar = (props) => { - const sidebarInvites = Object.keys(props.invites) - .map((uid) => { - return ( - props.api.invite.accept('/link', uid)} - onDecline={() => props.api.invite.decline('/link', uid)} - /> - ); - }); - - const associations = props.associations.contacts ? - alphabetiseAssociations(props.associations.contacts) : {}; - - const graphAssoc = props.associations.graph || {}; - - const groupedChannels = {}; - [...props.graphKeys].map((gKey) => { - const path = `/ship/~${gKey.split('/')[0]}/${gKey.split('/')[1]}`; - const groupPath = graphAssoc[path] ? graphAssoc[path]['group-path'] : ''; - - if (groupPath in associations) { - // managed - - if (groupedChannels[groupPath]) { - const array = groupedChannels[groupPath]; - array.push(path); - groupedChannels[groupPath] = array; - } else { - groupedChannels[groupPath] = [path]; - } - - } else { - // unmanaged - - if (groupedChannels['/~/']) { - const array = groupedChannels['/~/']; - array.push(path); - groupedChannels['/~/'] = array; - } else { - groupedChannels['/~/'] = [path]; - } - } - }); - - const groupedItems = Object.keys(associations).map((each, i) => { - const channels = groupedChannels[each]; - if (!channels || channels.length === 0) { return; } - - return ( - - ); - }); - - if (groupedChannels['/~/'] && groupedChannels['/~/'].length !== 0) { - groupedItems.push( - - ); - } - - const activeClasses = (props.active === 'collections') ? ' ' : 'dn-s '; - - return ( -
-
-
- - New Collection - -
- - {sidebarInvites} - {groupedItems} -
-
- ); -}; - diff --git a/pkg/interface/src/views/apps/links/components/lib/group-item.js b/pkg/interface/src/views/apps/links/components/lib/group-item.js deleted file mode 100644 index 175d57ae15..0000000000 --- a/pkg/interface/src/views/apps/links/components/lib/group-item.js +++ /dev/null @@ -1,43 +0,0 @@ -import React, { Component } from 'react'; -import { ChannelItem } from './channel-item'; -import { deSig } from '~/logic/lib/util'; - - -export const GroupItem = (props) => { - const association = props.association ? props.association : {}; - - let title = - association['app-path'] ? association['app-path'] : 'Unmanaged Collections'; - - if (association.metadata && association.metadata.title) { - title = association.metadata.title !== '' - ? association.metadata.title : title; - } - - const channels = props.channels ? props.channels : []; - const unmanaged = props.unmanaged ? 'pt6' : 'pt1'; - - const channelItems = channels.map((each, i) => { - const meta = props.metadata[each]; - if (!meta) { return null; } - const link = `${deSig(each.split('/')[2])}/${each.split('/')[3]}`; - - const selected = (props.selected === each); - return ( - - ); - }); - - return ( -
-

{title}

- {channelItems} -
- ); -}; - diff --git a/pkg/interface/src/views/apps/links/components/lib/member-element.js b/pkg/interface/src/views/apps/links/components/lib/member-element.js deleted file mode 100644 index 9828d3bf44..0000000000 --- a/pkg/interface/src/views/apps/links/components/lib/member-element.js +++ /dev/null @@ -1,55 +0,0 @@ -import React, { Component } from 'react'; -import { Sigil } from '~/logic/lib/sigil'; -import { uxToHex, cite } from '~/logic/lib/util'; -export class MemberElement extends Component { - onRemove() { - const { props } = this; - props.api.groups.remove(props.groupPath, [`~${props.ship}`]); - } - - render() { - const { props } = this; - - let actionElem; - if (props.ship === props.owner) { - actionElem = ( -

- Host -

- ); - } else if (props.amOwner && window.ship !== props.ship) { - actionElem = ( - - Ban - - ); - } else { - actionElem = ( - - ); - } - - const name = props.contact - ? `${props.contact.nickname} (${cite(props.ship)})` - : `${cite(props.ship)}`; - const color = props.contact ? uxToHex(props.contact.color) : '000000'; - - const img = props.contact.avatar - ? - : ; - - return ( -
- {img} -

- {name} -

- {actionElem} -
- ); - } -} diff --git a/pkg/interface/src/views/apps/links/components/lib/message-screen.js b/pkg/interface/src/views/apps/links/components/lib/message-screen.js deleted file mode 100644 index deb26f4655..0000000000 --- a/pkg/interface/src/views/apps/links/components/lib/message-screen.js +++ /dev/null @@ -1,15 +0,0 @@ -import React, { Component } from 'react'; - -export class MessageScreen extends Component { - render() { - return ( -
-
-

- {this.props.text} -

-
-
- ); - } -} diff --git a/pkg/interface/src/views/apps/links/components/lib/pagination.js b/pkg/interface/src/views/apps/links/components/lib/pagination.js deleted file mode 100644 index 39038b8b6e..0000000000 --- a/pkg/interface/src/views/apps/links/components/lib/pagination.js +++ /dev/null @@ -1,37 +0,0 @@ -import React, { Component } from 'react'; -import { Link } from 'react-router-dom'; -import { makeRoutePath } from '~/logic/lib/util'; - -export class Pagination extends Component { - render() { - const props = this.props; - - const prevPage = (Number(props.page) - 1); - const nextPage = (Number(props.page) + 1); - - const prevDisplay = ((props.currentPage > 0)) - ? 'dib absolute left-0' - : 'dn'; - - const nextDisplay = ((props.currentPage + 1) < props.totalPages) - ? 'dib absolute right-0' - : 'dn'; - - return ( -
-
- - <- Previous Page - -
-
- - Next Page -> - -
-
- ); - } -} - -export default Pagination; diff --git a/pkg/interface/src/views/apps/links/components/lib/welcome.js b/pkg/interface/src/views/apps/links/components/lib/welcome.js deleted file mode 100644 index 78e92e82ec..0000000000 --- a/pkg/interface/src/views/apps/links/components/lib/welcome.js +++ /dev/null @@ -1,41 +0,0 @@ -import React, { Component } from 'react'; - -export class Welcome extends Component { - constructor() { - super(); - this.state = { - show: true - }; - this.disableWelcome = this.disableWelcome.bind(this); - } - - disableWelcome() { - this.setState({ show: false }); - localStorage.setItem('urbit-link:wasWelcomed', JSON.stringify(true)); - } - - render() { - let wasWelcomed = localStorage.getItem('urbit-link:wasWelcomed'); - if (wasWelcomed === null) { - localStorage.setItem('urbit-link:wasWelcomed', JSON.stringify(false)); - return wasWelcomed = false; - } else { - wasWelcomed = JSON.parse(wasWelcomed); - } - - const associations = this.props.associations ? this.props.associations : {}; - - return ((!wasWelcomed && this.state.show) && (associations.length !== 0)) ? ( -
-

Links are for collecting and discussing outside content. Each post is a URL and a comment thread.

-

this.disableWelcome())} - > - Close this -

-
- ) :
; - } -} - -export default Welcome; diff --git a/pkg/interface/src/views/apps/links/components/link-detail.js b/pkg/interface/src/views/apps/links/components/link-detail.js deleted file mode 100644 index 60f3bd4a09..0000000000 --- a/pkg/interface/src/views/apps/links/components/link-detail.js +++ /dev/null @@ -1,100 +0,0 @@ -import React, { useEffect } from 'react'; -import { TabBar } from '~/views/components/chat-link-tabbar'; -import { LinkPreview } from './lib/link-preview'; -import { CommentSubmit } from './lib/comment-submit'; -import { SidebarSwitcher } from '~/views/components/SidebarSwitch'; -import { Link } from 'react-router-dom'; -import { Comments } from './lib/comments'; -import { getContactDetails } from '~/logic/lib/util'; - -import { Box } from '@tlon/indigo-react'; - -export const LinkDetail = (props) => { - if (!props.node && props.graphResource) { - useEffect(() => { - props.api.graph.getGraph( - `~${props.match.params.ship}`, - props.match.params.name - ); - }); - - return ( -
Loading...
- ); - } - - if (!props.node) { - return ( -
Not found
- ); - } - - const { nickname } = getContactDetails(props.contacts[props.node?.post?.author]); - const resourcePath = `${props.ship}/${props.name}`; - const title = props.resource.metadata.title || resourcePath; - - return ( -
- - - -

- {`${title}`} -

- - -
-
-
- -
- -
- -
-
-
- ); -}; - diff --git a/pkg/interface/src/views/apps/links/components/lib/link-item.js b/pkg/interface/src/views/apps/links/components/link-item.js similarity index 97% rename from pkg/interface/src/views/apps/links/components/lib/link-item.js rename to pkg/interface/src/views/apps/links/components/link-item.js index c4b3870b1b..068d69cdc2 100644 --- a/pkg/interface/src/views/apps/links/components/lib/link-item.js +++ b/pkg/interface/src/views/apps/links/components/link-item.js @@ -33,7 +33,7 @@ export const LinkItem = (props) => { ? : ; - const baseUrl = props.baseUrl || `/~link/${resource}`; + const baseUrl = props.baseUrl || `/~404/${resource}`; return ( diff --git a/pkg/interface/src/views/apps/links/components/link-list.js b/pkg/interface/src/views/apps/links/components/link-list.js deleted file mode 100644 index 6ded7f80cc..0000000000 --- a/pkg/interface/src/views/apps/links/components/link-list.js +++ /dev/null @@ -1,91 +0,0 @@ -import React, { useEffect } from "react"; - -import { TabBar } from '~/views/components/chat-link-tabbar'; -import { SidebarSwitcher } from '~/views/components/SidebarSwitch'; -import { Link } from 'react-router-dom'; -import { LinkItem } from './lib/link-item'; -import LinkSubmit from './lib/link-submit'; -import { Box } from '@tlon/indigo-react'; - -import { getContactDetails } from "~/logic/lib/util"; - -export const LinkList = (props) => { - const resource = `${props.ship}/${props.name}`; - const title = props.metadata.title || resource; - useEffect(() => { - props.api.graph.getGraph( - `~${props.match.params.ship}`, - props.match.params.name - ); - }, [props.match.params.ship, props.match.params.name]); - - if (!props.graph && props.graphResource) { - return
Loading...
; - } - - if (!props.graph) { - return
Not found
; - } - - return ( -
-
- {"⟵ All Channels"} -
- - -

- {title} -

- -
-
-
-
- -
- { Array.from(props.graph).map(([date, node]) => { - const { nickname, color, avatar } = - getContactDetails(props.contacts[node?.post?.author]); - return ( - - ); - }) - } -
-
-
- ); -}; diff --git a/pkg/interface/src/views/apps/links/components/lib/link-preview.js b/pkg/interface/src/views/apps/links/components/link-preview.js similarity index 100% rename from pkg/interface/src/views/apps/links/components/lib/link-preview.js rename to pkg/interface/src/views/apps/links/components/link-preview.js diff --git a/pkg/interface/src/views/apps/links/components/lib/link-submit.tsx b/pkg/interface/src/views/apps/links/components/link-submit.tsx similarity index 100% rename from pkg/interface/src/views/apps/links/components/lib/link-submit.tsx rename to pkg/interface/src/views/apps/links/components/link-submit.tsx diff --git a/pkg/interface/src/views/apps/links/components/loading.js b/pkg/interface/src/views/apps/links/components/loading.js deleted file mode 100644 index de9c203d2b..0000000000 --- a/pkg/interface/src/views/apps/links/components/loading.js +++ /dev/null @@ -1,8 +0,0 @@ -import React, { Component } from 'react'; -import { MessageScreen } from './lib/message-screen'; - -export class LoadingScreen extends Component { - render() { - return (); - } -} diff --git a/pkg/interface/src/views/apps/links/components/new.tsx b/pkg/interface/src/views/apps/links/components/new.tsx deleted file mode 100644 index c474954ac3..0000000000 --- a/pkg/interface/src/views/apps/links/components/new.tsx +++ /dev/null @@ -1,105 +0,0 @@ -import React, { useCallback } from "react"; -import { RouteComponentProps } from "react-router-dom"; -import { Box, ManagedTextInputField as Input, Col } from "@tlon/indigo-react"; -import { Formik, Form } from "formik"; -import * as Yup from "yup"; - -import { AsyncButton } from "~/views/components/AsyncButton"; -import { FormError } from "~/views/components/FormError"; -import GroupSearch from "~/views/components/GroupSearch"; - -import GlobalApi from "~/logic/api/global"; -import { stringToSymbol } from "~/logic/lib/util"; -import { useWaitForProps } from "~/logic/lib/useWaitForProps"; - -import { Associations } from "~/types/metadata-update"; -import { Notebooks } from "~/types/publish-update"; -import { Groups, GroupPolicy } from "~/types/group-update"; - -const formSchema = Yup.object({ - name: Yup.string().required("Collection must have a name"), - description: Yup.string(), - group: Yup.string(), -}); - - -export function NewScreen(props: object) { - const { history, api } = props; - const waiter = useWaitForProps(props, 5000); - - const onSubmit = async (values: object, actions) => { - const resourceId = stringToSymbol(values.name); - try { - const { name, description, group } = values; - if (!!group) { - await props.api.graph.createManagedGraph( - resourceId, - name, - description, - group, - "link" - ); - } else { - await props.api.graph.createUnmanagedGraph( - resourceId, - name, - description, - { invite: { pending: [] } }, - "link" - ); - } - - await waiter((p) => p?.graphKeys?.has(`${window.ship}/${resourceId}`)); - actions.setStatus({ success: null }); - history.push(`/~link/${window.ship}/${resourceId}`); - } catch (e) { - console.error(e); - actions.setStatus({ error: "Collection creation failed" }); - } - }; - - return ( - - New Collection - -
- - - - - - - Create Collection - - - - -
-
- - ); -} - -export default NewScreen; diff --git a/pkg/interface/src/views/apps/links/components/settings.js b/pkg/interface/src/views/apps/links/components/settings.js deleted file mode 100644 index b95e94264b..0000000000 --- a/pkg/interface/src/views/apps/links/components/settings.js +++ /dev/null @@ -1,184 +0,0 @@ -import React, { Component } from 'react'; - -import { Link } from 'react-router-dom'; - -import { LoadingScreen } from './loading'; -import { Spinner } from '~/views/components/Spinner'; -import { TabBar } from '~/views/components/chat-link-tabbar'; -import SidebarSwitcher from '~/views/components/SidebarSwitch'; - -import { MetadataSettings } from '~/views/components/metadata/settings'; - -import { Box, Text, Button, Col, Row } from '@tlon/indigo-react'; - -export class SettingsScreen extends Component { - constructor(props) { - super(props); - - this.state = { - isLoading: false, - awaiting: false, - type: 'Editing' - }; - - this.renderDelete = this.renderDelete.bind(this); - this.changeLoading = this.changeLoading.bind(this); - } - - componentDidUpdate() { - const { props, state } = this; - - if (Boolean(state.isLoading) && !props.resource) { - this.setState({ - isLoading: false - }, () => { - props.history.push('/~link'); - }); - } - } - - changeLoading(isLoading, awaiting, type, closure) { - this.setState({ - isLoading, - awaiting, - type - }, closure); - } - - removeCollection() { - const { props } = this; - - this.setState({ - isLoading: true, - awaiting: true, - type: 'Removing' - }); - - props.api.graph.leaveGraph( - `~${props.match.params.ship}`, - props.match.params.name - ); - } - - deleteCollection() { - const { props } = this; - - this.setState({ - isLoading: true, - awaiting: true, - type: 'Deleting' - }); - - props.api.graph.deleteGraph(props.match.params.name); - } - - renderRemove() { - const { props } = this; - - if (props.amOwner) { - return null; - } else { - return ( - - Remove Collection - - Remove this collection from your collection list - - - - ); - } - } - - renderDelete() { - const { props } = this; - - if (!props.amOwner) { - return null; - } else { - return ( - - Delete collection - - Delete this collection, for you and all group members - - - - ); - } - } - - render() { - const { props, state } = this; - const title = props.resource.metadata.title || props.resourcePath; - - if ( - (!props.hasGraph || !props.resource.metadata.color) - && props.graphResource - ) { - return ; - } else if (!props.graphResource) { - props.history.push('/~link'); - return ; - } - - return ( - - - {'⟵ All Collections'} - - - - - - {title} - - - - - - Collection Settings - {this.renderRemove()} - {this.renderDelete()} - - - - - ); - } -} diff --git a/pkg/interface/src/views/apps/links/components/skeleton.js b/pkg/interface/src/views/apps/links/components/skeleton.js deleted file mode 100644 index ad2c9b3dc0..0000000000 --- a/pkg/interface/src/views/apps/links/components/skeleton.js +++ /dev/null @@ -1,36 +0,0 @@ -import React, { Component } from 'react'; -import { ChannelSidebar } from './lib/channel-sidebar'; -import ErrorBoundary from '~/views/components/ErrorBoundary'; - -export class Skeleton extends Component { - render() { - const { props } = this; - const rightPanelHide = props.rightPanelHide ? 'dn-s' : ''; - - const linkInvites = ('/link' in props.invites) - ? props.invites['/link'] : {}; - - return ( -
-
- -
- - {props.children} - -
-
-
- ); - } -} diff --git a/pkg/interface/src/views/components/chat-link-tabbar.js b/pkg/interface/src/views/components/chat-link-tabbar.js deleted file mode 100644 index 9b8f9a5b18..0000000000 --- a/pkg/interface/src/views/components/chat-link-tabbar.js +++ /dev/null @@ -1,30 +0,0 @@ -import React from 'react'; -import { Link } from 'react-router-dom'; - -import { Box } from '@tlon/indigo-react'; - -export const TabBar = (props) => { - const { - location, - settings, - } = props; - let setColor = ''; - - if (location.pathname.includes('/settings')) { - setColor = 'black white-d'; - } else { - setColor = 'gray3'; - } - - return ( - - - - Settings - - - - ); -};