mirror of
https://github.com/ilyakooo0/urbit.git
synced 2024-12-15 01:52:42 +03:00
interface: wip links frontend migration
This commit is contained in:
parent
6bf2ec28a6
commit
5608a7c4b7
@ -28,8 +28,6 @@ export class LinksApp extends Component {
|
||||
// preload spinner asset
|
||||
new Image().src = '/~landscape/img/Spinner.png';
|
||||
|
||||
this.props.api.links.getPage('', 0);
|
||||
this.props.subscription.startApp('link');
|
||||
this.props.subscription.startApp('graph');
|
||||
if (!this.props.sidebarShown) {
|
||||
this.props.api.local.sidebarToggle();
|
||||
@ -37,7 +35,6 @@ export class LinksApp extends Component {
|
||||
}
|
||||
|
||||
componentWillUnmount() {
|
||||
this.props.subscription.stopApp('link');
|
||||
this.props.subscription.stopApp('graph');
|
||||
}
|
||||
|
||||
@ -46,25 +43,17 @@ export class LinksApp extends Component {
|
||||
const contacts = props.contacts ? props.contacts : {};
|
||||
const groups = props.groups ? props.groups : {};
|
||||
const associations = props.associations ? props.associations : { link: {}, contacts: {} };
|
||||
const links = props.links ? props.links : {};
|
||||
const comments = props.linkComments ? props.linkComments : {};
|
||||
const seen = props.linksSeen ? props.linksSeen : {};
|
||||
const totalUnseen = _.reduce(
|
||||
links,
|
||||
(acc, collection) => acc + collection.unseenCount,
|
||||
0
|
||||
);
|
||||
const graphKeys = props.graphKeys || new Set([]);
|
||||
|
||||
const invites = props.invites ?
|
||||
props.invites : {};
|
||||
|
||||
const listening = props.linkListening;
|
||||
const { api, sidebarShown, hideAvatars, hideNicknames } = this.props;
|
||||
|
||||
return (
|
||||
<>
|
||||
<Helmet defer={false}>
|
||||
<title>{totalUnseen > 0 ? `(${totalUnseen}) ` : ''}OS1 - Links</title>
|
||||
<title>OS1 - Links</title>
|
||||
</Helmet>
|
||||
<Switch>
|
||||
<Route exact path="/~link"
|
||||
@ -77,9 +66,8 @@ export class LinksApp extends Component {
|
||||
groups={groups}
|
||||
rightPanelHide={true}
|
||||
sidebarShown={sidebarShown}
|
||||
links={links}
|
||||
listening={listening}
|
||||
api={api}
|
||||
graphKeys={graphKeys}
|
||||
>
|
||||
<MessageScreen text="Select or create a collection to begin." />
|
||||
</Skeleton>
|
||||
@ -94,8 +82,6 @@ export class LinksApp extends Component {
|
||||
invites={invites}
|
||||
groups={groups}
|
||||
sidebarShown={sidebarShown}
|
||||
links={links}
|
||||
listening={listening}
|
||||
api={api}
|
||||
>
|
||||
<NewScreen
|
||||
@ -141,8 +127,6 @@ export class LinksApp extends Component {
|
||||
groups={groups}
|
||||
selected={resourcePath}
|
||||
sidebarShown={sidebarShown}
|
||||
links={links}
|
||||
listening={listening}
|
||||
api={api}
|
||||
>
|
||||
<MemberScreen
|
||||
@ -182,8 +166,6 @@ export class LinksApp extends Component {
|
||||
selected={resourcePath}
|
||||
sidebarShown={sidebarShown}
|
||||
popout={popout}
|
||||
links={links}
|
||||
listening={listening}
|
||||
api={api}
|
||||
>
|
||||
<SettingsScreen
|
||||
@ -216,18 +198,6 @@ export class LinksApp extends Component {
|
||||
|
||||
const popout = props.match.url.includes('/popout/');
|
||||
|
||||
const channelLinks = links[resourcePath]
|
||||
? links[resourcePath]
|
||||
: { local: {} };
|
||||
|
||||
const channelComments = comments[resourcePath]
|
||||
? comments[resourcePath]
|
||||
: {};
|
||||
|
||||
const channelSeen = seen[resourcePath]
|
||||
? seen[resourcePath]
|
||||
: {};
|
||||
|
||||
return (
|
||||
<Skeleton
|
||||
associations={associations}
|
||||
@ -237,16 +207,11 @@ export class LinksApp extends Component {
|
||||
sidebarShown={sidebarShown}
|
||||
sidebarHideMobile={true}
|
||||
popout={popout}
|
||||
links={links}
|
||||
listening={listening}
|
||||
api={api}
|
||||
>
|
||||
<Links
|
||||
{...props}
|
||||
contacts={contactDetails}
|
||||
links={channelLinks}
|
||||
comments={channelComments}
|
||||
seen={channelSeen}
|
||||
page={page}
|
||||
resourcePath={resourcePath}
|
||||
resource={resource}
|
||||
@ -276,17 +241,6 @@ export class LinksApp extends Component {
|
||||
const page = props.match.params.page || 0;
|
||||
const url = base64urlDecode(props.match.params.encodedUrl);
|
||||
|
||||
const data = links[resourcePath]
|
||||
? links[resourcePath][page]
|
||||
? links[resourcePath][page][index]
|
||||
: {}
|
||||
: {};
|
||||
const coms = !comments[resourcePath]
|
||||
? undefined
|
||||
: comments[resourcePath][url];
|
||||
|
||||
const commentPage = props.match.params.commentpage || 0;
|
||||
|
||||
return (
|
||||
<Skeleton
|
||||
associations={associations}
|
||||
@ -296,8 +250,6 @@ export class LinksApp extends Component {
|
||||
sidebarShown={sidebarShown}
|
||||
sidebarHideMobile={true}
|
||||
popout={popout}
|
||||
links={links}
|
||||
listening={listening}
|
||||
api={api}
|
||||
>
|
||||
<LinkDetail
|
||||
@ -312,9 +264,6 @@ export class LinksApp extends Component {
|
||||
amOwner={amOwner}
|
||||
popout={popout}
|
||||
sidebarShown={sidebarShown}
|
||||
data={data}
|
||||
comments={coms}
|
||||
commentPage={commentPage}
|
||||
api={api}
|
||||
hideAvatars={hideAvatars}
|
||||
hideNicknames={hideNicknames}
|
||||
|
@ -27,7 +27,8 @@ export class ChannelsSidebar extends Component {
|
||||
const associations = props.associations.contacts ? alphabetiseAssociations(props.associations.contacts) : {};
|
||||
|
||||
const groupedChannels = {};
|
||||
[...props.listening].map((path) => {
|
||||
console.log(props.graphKeys);
|
||||
[...props.graphKeys].map((path) => {
|
||||
const groupPath = props.associations.link[path] ?
|
||||
props.associations.link[path]['group-path'] : '';
|
||||
|
||||
@ -70,23 +71,10 @@ export class ChannelsSidebar extends Component {
|
||||
linkMetadata={props.associations['link']}
|
||||
channels={channels}
|
||||
selected={props.selected}
|
||||
links={props.links}
|
||||
/>
|
||||
);
|
||||
});
|
||||
if (groupedChannels['/~/'] && groupedChannels['/~/'].length !== 0) {
|
||||
groupedItems.unshift(
|
||||
<GroupItem
|
||||
key={'/~/'}
|
||||
index={0}
|
||||
association={'/~/'}
|
||||
linkMetadata={props.associations['link']}
|
||||
channels={groupedChannels['/~/']}
|
||||
selected={props.selected}
|
||||
links={props.links}
|
||||
/>
|
||||
);
|
||||
}
|
||||
//TODO handle unmanaged links
|
||||
|
||||
const activeClasses = (props.active === 'collections') ? ' ' : 'dn-s ';
|
||||
|
||||
|
@ -21,18 +21,14 @@ export class GroupItem extends Component {
|
||||
if (!meta)
|
||||
return null;
|
||||
const selected = (props.selected === each);
|
||||
const unseenCount = props.links[each]
|
||||
? props.links[each].unseenCount
|
||||
: 0;
|
||||
return (
|
||||
<ChannelsItem
|
||||
key={each}
|
||||
link={each}
|
||||
selected={selected}
|
||||
unseenCount={unseenCount}
|
||||
name={meta.metadata.title}
|
||||
/>
|
||||
);
|
||||
return (
|
||||
<ChannelsItem
|
||||
key={each}
|
||||
link={each}
|
||||
selected={selected}
|
||||
name={meta.metadata.title}
|
||||
/>
|
||||
);
|
||||
});
|
||||
return (
|
||||
<div className={first}>
|
||||
|
@ -32,9 +32,8 @@ export class Skeleton extends Component {
|
||||
groups={props.groups}
|
||||
selected={props.selected}
|
||||
sidebarShown={props.sidebarShown}
|
||||
links={props.links}
|
||||
listening={props.listening}
|
||||
api={props.api}
|
||||
graphKeys={props.graphKeys}
|
||||
/>
|
||||
<div className={'h-100 w-100 flex-auto relative ' + rightPanelHide} style={{
|
||||
flexGrow: 1
|
||||
|
Loading…
Reference in New Issue
Block a user