From db4c0bcb8731f135d166235a21b7c6003248abb6 Mon Sep 17 00:00:00 2001 From: James Acklin Date: Wed, 10 Mar 2021 16:11:05 -0500 Subject: [PATCH 01/23] settings: sidebar same width as groups fixes urbit/landscape#541 --- .../src/views/apps/settings/settings.tsx | 118 ++++++++---------- 1 file changed, 53 insertions(+), 65 deletions(-) diff --git a/pkg/interface/src/views/apps/settings/settings.tsx b/pkg/interface/src/views/apps/settings/settings.tsx index 0fb9d94d3..912d32821 100644 --- a/pkg/interface/src/views/apps/settings/settings.tsx +++ b/pkg/interface/src/views/apps/settings/settings.tsx @@ -1,35 +1,42 @@ -import React, { ReactNode } from "react"; -import { useLocation } from "react-router-dom"; -import Helmet from "react-helmet"; +import React, { ReactNode } from 'react'; +import { useLocation } from 'react-router-dom'; +import Helmet from 'react-helmet'; import { Text, Box, Col, Row } from '@tlon/indigo-react'; -import { NotificationPreferences } from "./components/lib/NotificationPref"; -import DisplayForm from "./components/lib/DisplayForm"; -import S3Form from "./components/lib/S3Form"; -import { CalmPrefs } from "./components/lib/CalmPref"; -import SecuritySettings from "./components/lib/Security"; -import { LeapSettings } from "./components/lib/LeapSettings"; -import { useHashLink } from "~/logic/lib/useHashLink"; -import { SidebarItem as BaseSidebarItem } from "~/views/landscape/components/SidebarItem"; -import { PropFunc } from "~/types"; +import { NotificationPreferences } from './components/lib/NotificationPref'; +import DisplayForm from './components/lib/DisplayForm'; +import S3Form from './components/lib/S3Form'; +import { CalmPrefs } from './components/lib/CalmPref'; +import SecuritySettings from './components/lib/Security'; +import { LeapSettings } from './components/lib/LeapSettings'; +import { useHashLink } from '~/logic/lib/useHashLink'; +import { SidebarItem as BaseSidebarItem } from '~/views/landscape/components/SidebarItem'; +import { PropFunc } from '~/types'; export const Skeleton = (props: { children: ReactNode }) => ( - + {props.children} ); -type ProvSideProps = "to" | "selected"; +type ProvSideProps = 'to' | 'selected'; type BaseProps = PropFunc; function SidebarItem(props: { hash: string } & Omit) { const { hash, icon, text, ...rest } = props; @@ -54,16 +61,15 @@ function SettingsItem(props: { children: ReactNode }) { const { children } = props; return ( - + {children} ); } export default function SettingsScreen(props: any) { - const location = useLocation(); - const hash = location.hash.slice(1) + const hash = location.hash.slice(1); return ( <> @@ -71,65 +77,47 @@ export default function SettingsScreen(props: any) { Landscape - Settings - + - + System Preferences - + - - - - + + + + - + - {hash === "notifications" && ( + {hash === 'notifications' && ( )} - {hash === "display" && ( - - )} - {hash === "s3" && ( - - )} - {hash === "leap" && ( - - )} - {hash === "calm" && ( - - )} - {hash === "security" && ( - - )} + {hash === 'display' && } + {hash === 's3' && } + {hash === 'leap' && } + {hash === 'calm' && } + {hash === 'security' && } From 41556cd5632b15a1bcec8c255f78e3611a40b2ee Mon Sep 17 00:00:00 2001 From: Matilde Park Date: Wed, 10 Mar 2021 20:23:24 -0500 Subject: [PATCH 02/23] interface: remove deprecated types and props --- pkg/interface/src/views/components/UnjoinedResource.tsx | 8 +++----- .../src/views/landscape/components/Sidebar/Sidebar.tsx | 1 - pkg/interface/src/views/landscape/components/Skeleton.tsx | 4 ---- 3 files changed, 3 insertions(+), 10 deletions(-) diff --git a/pkg/interface/src/views/components/UnjoinedResource.tsx b/pkg/interface/src/views/components/UnjoinedResource.tsx index ab14aed2d..8e9156a7c 100644 --- a/pkg/interface/src/views/components/UnjoinedResource.tsx +++ b/pkg/interface/src/views/components/UnjoinedResource.tsx @@ -9,15 +9,13 @@ import { StatelessAsyncButton as AsyncButton, StatelessAsyncButton } from './StatelessAsyncButton'; -import { Notebooks, Graphs, Inbox } from '@urbit/api'; +import { Graphs } from '@urbit/api'; import useGraphState from '~/logic/state/graph'; interface UnjoinedResourceProps { association: Association; api: GlobalApi; baseUrl: string; - notebooks: Notebooks; - inbox: Inbox; } function isJoined(path: string) { @@ -31,7 +29,7 @@ function isJoined(path: string) { } export function UnjoinedResource(props: UnjoinedResourceProps) { - const { api, notebooks, inbox } = props; + const { api } = props; const history = useHistory(); const rid = props.association.resource; const appName = props.association['app-name']; @@ -52,7 +50,7 @@ export function UnjoinedResource(props: UnjoinedResourceProps) { if (isJoined(rid)({ graphKeys })) { history.push(`${props.baseUrl}/resource/${app}${rid}`); } - }, [props.association, inbox, graphKeys, notebooks]); + }, [props.association, graphKeys]); return (
diff --git a/pkg/interface/src/views/landscape/components/Sidebar/Sidebar.tsx b/pkg/interface/src/views/landscape/components/Sidebar/Sidebar.tsx index 62d2103af..ceb741a0e 100644 --- a/pkg/interface/src/views/landscape/components/Sidebar/Sidebar.tsx +++ b/pkg/interface/src/views/landscape/components/Sidebar/Sidebar.tsx @@ -37,7 +37,6 @@ interface SidebarProps { api: GlobalApi; selected?: string; selectedGroup?: string; - includeUnmanaged?: boolean; apps: SidebarAppConfigs; baseUrl: string; mobileHide?: boolean; diff --git a/pkg/interface/src/views/landscape/components/Skeleton.tsx b/pkg/interface/src/views/landscape/components/Skeleton.tsx index b1971041d..ea1280a92 100644 --- a/pkg/interface/src/views/landscape/components/Skeleton.tsx +++ b/pkg/interface/src/views/landscape/components/Skeleton.tsx @@ -5,7 +5,6 @@ import { Associations } from '@urbit/api/metadata'; import { Sidebar } from './Sidebar/Sidebar'; import GlobalApi from '~/logic/api/global'; -import GlobalSubscription from '~/logic/subscription/global'; import { useGraphModule } from './Sidebar/Apps'; import { Body } from '~/views/components/Body'; import { Workspace } from '~/types/workspace'; @@ -16,14 +15,11 @@ import ErrorBoundary from '~/views/components/ErrorBoundary'; interface SkeletonProps { children: ReactNode; recentGroups: string[]; - linkListening: Set; selected?: string; selectedApp?: AppName; baseUrl: string; mobileHide?: boolean; api: GlobalApi; - subscription: GlobalSubscription; - includeUnmanaged: boolean; workspace: Workspace; } From af38b0ee2db4d6a0f9a6a641eb06bbec3af2ce37 Mon Sep 17 00:00:00 2001 From: Matilde Park Date: Wed, 10 Mar 2021 20:23:38 -0500 Subject: [PATCH 03/23] GroupsPane: reference correct associations object --- .../src/views/landscape/components/GroupsPane.tsx | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/pkg/interface/src/views/landscape/components/GroupsPane.tsx b/pkg/interface/src/views/landscape/components/GroupsPane.tsx index 9f66d516e..658f0e599 100644 --- a/pkg/interface/src/views/landscape/components/GroupsPane.tsx +++ b/pkg/interface/src/views/landscape/components/GroupsPane.tsx @@ -158,8 +158,6 @@ export function GroupsPane(props: GroupsPaneProps) { baseUrl={baseUrl} > { - const hasDescription = groupAssociation?.metadata?.description; - const channelCount = Object.keys(props?.associations?.graph ?? {}).filter((e) => { - return props?.associations?.graph?.[e]?.['group'] === groupPath; + const channelCount = Object.keys(associations?.graph ?? {}).filter((e) => { + return associations?.graph?.[e]?.['group'] === groupPath; }).length; let summary: ReactNode; if(groupAssociation?.group) { From cce7c890f48044842e549818f6c86aa4d7b20505 Mon Sep 17 00:00:00 2001 From: James Acklin Date: Thu, 11 Mar 2021 12:41:06 -0500 Subject: [PATCH 04/23] settings: removes superfluous flex container, pads back button on mobile fixes urbit/landscape#541 --- .../settings/components/lib/BackButton.tsx | 12 ++- .../apps/settings/components/lib/S3Form.tsx | 45 +++++----- .../src/views/apps/settings/settings.tsx | 85 +++++++++---------- 3 files changed, 75 insertions(+), 67 deletions(-) diff --git a/pkg/interface/src/views/apps/settings/components/lib/BackButton.tsx b/pkg/interface/src/views/apps/settings/components/lib/BackButton.tsx index 570618c64..1fdcc633c 100644 --- a/pkg/interface/src/views/apps/settings/components/lib/BackButton.tsx +++ b/pkg/interface/src/views/apps/settings/components/lib/BackButton.tsx @@ -4,8 +4,16 @@ import { Text } from '@tlon/indigo-react'; export function BackButton(props: {}) { return ( - - {"<- Back to System Preferences"} + + + {'<- Back to System Preferences'} + ); } diff --git a/pkg/interface/src/views/apps/settings/components/lib/S3Form.tsx b/pkg/interface/src/views/apps/settings/components/lib/S3Form.tsx index 1e90dcbe6..24f10b7a9 100644 --- a/pkg/interface/src/views/apps/settings/components/lib/S3Form.tsx +++ b/pkg/interface/src/views/apps/settings/components/lib/S3Form.tsx @@ -11,12 +11,12 @@ import { Anchor } from '@tlon/indigo-react'; -import GlobalApi from "~/logic/api/global"; -import { BucketList } from "./BucketList"; +import GlobalApi from '~/logic/api/global'; +import { BucketList } from './BucketList'; import { S3State } from '~/types/s3-update'; import useS3State from '~/logic/state/storage'; import { BackButton } from './BackButton'; -import {StorageState} from '~/types'; +import { StorageState } from '~/types'; import useStorageState from '~/logic/state/storage'; interface FormSchema { @@ -33,7 +33,7 @@ interface S3FormProps { export default function S3Form(props: S3FormProps): ReactElement { const { api } = props; - const s3 = useStorageState(state => state.s3); + const s3 = useStorageState((state) => state.s3); const onSubmit = useCallback( (values: FormSchema) => { @@ -54,7 +54,8 @@ export default function S3Form(props: S3FormProps): ReactElement { return ( <> - + +
- - - - + + + S3 Storage Setup Store credentials for your S3 object storage buckets on your Urbit ship, and upload media freely to various modules. + borderBottom='1' + ml='1' + href='https://urbit.org/using/operations/using-your-ship/#bucket-setup' + > Learn more - - + + -
- - - + + + S3 Buckets diff --git a/pkg/interface/src/views/apps/settings/settings.tsx b/pkg/interface/src/views/apps/settings/settings.tsx index 912d32821..eb0c37e6d 100644 --- a/pkg/interface/src/views/apps/settings/settings.tsx +++ b/pkg/interface/src/views/apps/settings/settings.tsx @@ -77,50 +77,49 @@ export default function SettingsScreen(props: any) { Landscape - Settings - - - - System Preferences - - - - - - - - - + + + System Preferences + + + + + + + + - - - {hash === 'notifications' && ( - - )} - {hash === 'display' && } - {hash === 's3' && } - {hash === 'leap' && } - {hash === 'calm' && } - {hash === 'security' && } - - - + + + + {hash === 'notifications' && ( + + )} + {hash === 'display' && } + {hash === 's3' && } + {hash === 'leap' && } + {hash === 'calm' && } + {hash === 'security' && } + + ); From dd0252542d60afc3c0a145ca0ad75d37eaf5253f Mon Sep 17 00:00:00 2001 From: Matilde Park Date: Thu, 11 Mar 2021 12:41:07 -0500 Subject: [PATCH 05/23] publish: allow admins to delete posts, comments --- .../views/apps/publish/components/Note.tsx | 58 +++++++++++-------- .../src/views/components/CommentItem.tsx | 44 +++++++++----- 2 files changed, 62 insertions(+), 40 deletions(-) diff --git a/pkg/interface/src/views/apps/publish/components/Note.tsx b/pkg/interface/src/views/apps/publish/components/Note.tsx index 123db344e..4b0f7d761 100644 --- a/pkg/interface/src/views/apps/publish/components/Note.tsx +++ b/pkg/interface/src/views/apps/publish/components/Note.tsx @@ -1,5 +1,5 @@ import React, { useState, useEffect } from 'react'; -import { Box, Text, Col, Anchor } from '@tlon/indigo-react'; +import { Box, Text, Col, Anchor, Row } from '@tlon/indigo-react'; import ReactMarkdown from 'react-markdown'; import bigInt from 'big-integer'; @@ -9,6 +9,7 @@ import { Comments } from '~/views/components/Comments'; import { NoteNavigation } from './NoteNavigation'; import GlobalApi from '~/logic/api/global'; import { getLatestRevision, getComments } from '~/logic/lib/publish'; +import { roleForShip } from '~/logic/lib/group'; import Author from '~/views/components/Author'; import { Contacts, GraphNode, Graph, Association, Unreads, Group } from '@urbit/api'; @@ -54,29 +55,37 @@ export function Note(props: NoteProps & RouteComponentProps) { api.hark.markEachAsRead(props.association, '/',`/${index[1]}/1/1`, 'note', 'publish'); }, [props.association, props.note]); - let adminLinks: JSX.Element | null = null; + let adminLinks: JSX.Element[] = []; + const ourRole = roleForShip(group, window.ship); if (window.ship === note?.post?.author) { - adminLinks = ( - - - - Update - + + Update + - - Delete - - - ); - } + ) + }; + + if (window.ship === note?.post?.author || ourRole === "admin") { + adminLinks.push( + + Delete + + ) + }; const windowRef = React.useRef(null); useEffect(() => { @@ -103,13 +112,14 @@ export function Note(props: NoteProps & RouteComponentProps) { {title || ''} - + - {adminLinks} - + {adminLinks} + diff --git a/pkg/interface/src/views/components/CommentItem.tsx b/pkg/interface/src/views/components/CommentItem.tsx index c0054c3f5..ba85299a1 100644 --- a/pkg/interface/src/views/components/CommentItem.tsx +++ b/pkg/interface/src/views/components/CommentItem.tsx @@ -10,6 +10,7 @@ import { Group } from '@urbit/api'; import GlobalApi from '~/logic/api/global'; import Author from '~/views/components/Author'; import { MentionText } from '~/views/components/MentionText'; +import { roleForShip } from '~/logic/lib/group'; import { getLatestCommentRevision } from '~/logic/lib/publish'; const ClickBox = styled(Box)` @@ -31,7 +32,7 @@ interface CommentItemProps { export function CommentItem(props: CommentItemProps): ReactElement { const { ship, name, api, comment, group } = props; const [, post] = getLatestCommentRevision(comment); - const disabled = props.pending || window.ship !== post?.author; + const disabled = props.pending; const onDelete = async () => { await api.graph.removeNodes(ship, name, [comment.post?.index]); @@ -41,6 +42,29 @@ export function CommentItem(props: CommentItemProps): ReactElement { const commentIndex = commentIndexArray[commentIndexArray.length - 1]; const updateUrl = `${props.baseUrl}/${commentIndex}`; + const adminLinks: JSX.Element[] = []; + const ourRole = roleForShip(group, window.ship); + if (window.ship == post?.author && !disabled) { + adminLinks.push( + + + Update + + + ) + }; + + if ((window.ship == post?.author || ourRole == "admin") && !disabled) { + adminLinks.push( + + Delete + + ) + }; + return ( @@ -52,21 +76,9 @@ export function CommentItem(props: CommentItemProps): ReactElement { group={group} api={api} > - {!disabled && ( - - - - Update - - - - Delete - - - )} + + {adminLinks} + From 5189b3ea204b3be933a544e635143c727d296a13 Mon Sep 17 00:00:00 2001 From: Matilde Park Date: Thu, 11 Mar 2021 12:46:27 -0500 Subject: [PATCH 06/23] publish: render author's image and overlay --- pkg/interface/src/views/apps/publish/components/Note.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/pkg/interface/src/views/apps/publish/components/Note.tsx b/pkg/interface/src/views/apps/publish/components/Note.tsx index 4b0f7d761..8d5277cc3 100644 --- a/pkg/interface/src/views/apps/publish/components/Note.tsx +++ b/pkg/interface/src/views/apps/publish/components/Note.tsx @@ -114,6 +114,7 @@ export function Note(props: NoteProps & RouteComponentProps) { {title || ''} Date: Thu, 11 Mar 2021 12:46:41 -0500 Subject: [PATCH 07/23] landscape/Author: remove unnecessary api prop --- pkg/interface/src/views/apps/links/components/LinkItem.tsx | 6 +----- .../src/views/apps/publish/components/NotePreview.tsx | 3 --- .../src/views/apps/publish/components/Notebook.tsx | 4 ---- .../src/views/apps/publish/components/NotebookPosts.tsx | 2 -- pkg/interface/src/views/components/Author.tsx | 2 -- pkg/interface/src/views/components/CommentItem.tsx | 1 - 6 files changed, 1 insertion(+), 17 deletions(-) diff --git a/pkg/interface/src/views/apps/links/components/LinkItem.tsx b/pkg/interface/src/views/apps/links/components/LinkItem.tsx index d1922b0f3..9579f4f54 100644 --- a/pkg/interface/src/views/apps/links/components/LinkItem.tsx +++ b/pkg/interface/src/views/apps/links/components/LinkItem.tsx @@ -148,17 +148,13 @@ export const LinkItem = (props: LinkItemProps): ReactElement => { - - - + /> diff --git a/pkg/interface/src/views/apps/publish/components/Notebook.tsx b/pkg/interface/src/views/apps/publish/components/Notebook.tsx index 37296ecd9..0c5f23302 100644 --- a/pkg/interface/src/views/apps/publish/components/Notebook.tsx +++ b/pkg/interface/src/views/apps/publish/components/Notebook.tsx @@ -5,13 +5,11 @@ import { Col, Box, Text, Row } from '@tlon/indigo-react'; import { Contacts, Rolodex, Groups, Associations, Graph, Association, Unreads } from '@urbit/api'; import { NotebookPosts } from './NotebookPosts'; -import GlobalApi from '~/logic/api/global'; import { useShowNickname } from '~/logic/lib/util'; import useContactState from '~/logic/state/contact'; import useGroupState from '~/logic/state/group'; interface NotebookProps { - api: GlobalApi; ship: string; book: string; graph: Graph; @@ -40,7 +38,6 @@ export function Notebook(props: NotebookProps & RouteComponentProps): ReactEleme const contacts = useContactState(state => state.contacts); const contact = contacts?.[`~${ship}`]; - console.log(association.resource); const showNickname = useShowNickname(contact); @@ -61,7 +58,6 @@ export function Notebook(props: NotebookProps & RouteComponentProps): ReactEleme host={ship} book={book} baseUrl={props.baseUrl} - api={props.api} group={group} /> diff --git a/pkg/interface/src/views/apps/publish/components/NotebookPosts.tsx b/pkg/interface/src/views/apps/publish/components/NotebookPosts.tsx index 801e34e38..b18e74eed 100644 --- a/pkg/interface/src/views/apps/publish/components/NotebookPosts.tsx +++ b/pkg/interface/src/views/apps/publish/components/NotebookPosts.tsx @@ -11,7 +11,6 @@ interface NotebookPostsProps { baseUrl: string; hideAvatars?: boolean; hideNicknames?: boolean; - api: GlobalApi; group: Group; } @@ -29,7 +28,6 @@ export function NotebookPosts(props: NotebookPostsProps) { contact={contacts[`~${node.post.author}`]} node={node} baseUrl={props.baseUrl} - api={props.api} group={props.group} /> ) diff --git a/pkg/interface/src/views/components/Author.tsx b/pkg/interface/src/views/components/Author.tsx index 33fc3df54..063061a91 100644 --- a/pkg/interface/src/views/components/Author.tsx +++ b/pkg/interface/src/views/components/Author.tsx @@ -11,7 +11,6 @@ import useSettingsState, {selectCalmState} from "~/logic/state/settings"; import useLocalState from "~/logic/state/local"; import OverlaySigil from './OverlaySigil'; import { Sigil } from '~/logic/lib/sigil'; -import GlobalApi from '~/logic/api/global'; import Timestamp from './Timestamp'; import useContactState from '~/logic/state/contact'; @@ -22,7 +21,6 @@ interface AuthorProps { children?: ReactNode; unread?: boolean; group: Group; - api?: GlobalApi; } // eslint-disable-next-line max-lines-per-function diff --git a/pkg/interface/src/views/components/CommentItem.tsx b/pkg/interface/src/views/components/CommentItem.tsx index ba85299a1..50493f6f6 100644 --- a/pkg/interface/src/views/components/CommentItem.tsx +++ b/pkg/interface/src/views/components/CommentItem.tsx @@ -74,7 +74,6 @@ export function CommentItem(props: CommentItemProps): ReactElement { date={post?.['time-sent']} unread={props.unread} group={group} - api={api} > {adminLinks} From 534f5279a172c7737989cb4d9d3b72cf8a032bbd Mon Sep 17 00:00:00 2001 From: Tyler Brown Cifu Shuster Date: Wed, 10 Mar 2021 20:22:39 -0800 Subject: [PATCH 08/23] interface: added tool to track unneeded renders --- pkg/interface/config/webpack.dev.js | 6 +++++- pkg/interface/package-lock.json | 9 +++++++++ pkg/interface/package.json | 1 + pkg/interface/src/index.js | 1 + pkg/interface/src/logic/api/metadata.ts | 1 - .../src/views/apps/publish/components/Notebook.tsx | 1 - pkg/interface/src/views/components/RemoteContent.tsx | 2 -- pkg/interface/src/views/components/useTutorialModal.tsx | 4 +--- pkg/interface/src/wdyr.js | 8 ++++++++ 9 files changed, 25 insertions(+), 8 deletions(-) create mode 100644 pkg/interface/src/wdyr.js diff --git a/pkg/interface/config/webpack.dev.js b/pkg/interface/config/webpack.dev.js index 66bf83ce9..0f85b58a9 100644 --- a/pkg/interface/config/webpack.dev.js +++ b/pkg/interface/config/webpack.dev.js @@ -94,7 +94,11 @@ module.exports = { use: { loader: 'babel-loader', options: { - presets: ['@babel/preset-env', '@babel/typescript', '@babel/preset-react'], + presets: ['@babel/preset-env', '@babel/typescript', ['@babel/preset-react', { + runtime: 'automatic', + development: true, + importSource: '@welldone-software/why-did-you-render', + }]], plugins: [ '@babel/transform-runtime', '@babel/plugin-proposal-object-rest-spread', diff --git a/pkg/interface/package-lock.json b/pkg/interface/package-lock.json index 61b37093d..0c5535474 100644 --- a/pkg/interface/package-lock.json +++ b/pkg/interface/package-lock.json @@ -1995,6 +1995,15 @@ "@xtuc/long": "4.2.2" } }, + "@welldone-software/why-did-you-render": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/@welldone-software/why-did-you-render/-/why-did-you-render-6.1.0.tgz", + "integrity": "sha512-0s+PuKQ4v9VV1SZSM6iS7d2T7X288T3DF+K8yfkFAhI31HhJGGH1SY1ssVm+LqjSMyrVWT60ZF5r0qUsO0Z9Lw==", + "dev": true, + "requires": { + "lodash": "^4" + } + }, "@xtuc/ieee754": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/@xtuc/ieee754/-/ieee754-1.2.0.tgz", diff --git a/pkg/interface/package.json b/pkg/interface/package.json index 8b8c7853f..566510cca 100644 --- a/pkg/interface/package.json +++ b/pkg/interface/package.json @@ -71,6 +71,7 @@ "@types/yup": "^0.29.11", "@typescript-eslint/eslint-plugin": "^4.15.0", "@urbit/eslint-config": "file:../npm/eslint-config", + "@welldone-software/why-did-you-render": "^6.1.0", "babel-eslint": "^10.1.0", "babel-loader": "^8.2.2", "babel-plugin-lodash": "^3.3.4", diff --git a/pkg/interface/src/index.js b/pkg/interface/src/index.js index ded85a8f5..e62b46b2f 100644 --- a/pkg/interface/src/index.js +++ b/pkg/interface/src/index.js @@ -1,3 +1,4 @@ +import './wdyr'; import * as React from 'react'; import * as ReactDOM from 'react-dom'; diff --git a/pkg/interface/src/logic/api/metadata.ts b/pkg/interface/src/logic/api/metadata.ts index c2d388dfc..cae4fc6d6 100644 --- a/pkg/interface/src/logic/api/metadata.ts +++ b/pkg/interface/src/logic/api/metadata.ts @@ -77,7 +77,6 @@ export default class MetadataApi extends BaseApi { tempChannel.delete(); }, (ev: any) => { - console.log(ev); if ('metadata-hook-update' in ev) { done = true; tempChannel.delete(); diff --git a/pkg/interface/src/views/apps/publish/components/Notebook.tsx b/pkg/interface/src/views/apps/publish/components/Notebook.tsx index 37296ecd9..dc015986e 100644 --- a/pkg/interface/src/views/apps/publish/components/Notebook.tsx +++ b/pkg/interface/src/views/apps/publish/components/Notebook.tsx @@ -40,7 +40,6 @@ export function Notebook(props: NotebookProps & RouteComponentProps): ReactEleme const contacts = useContactState(state => state.contacts); const contact = contacts?.[`~${ship}`]; - console.log(association.resource); const showNickname = useShowNickname(contact); diff --git a/pkg/interface/src/views/components/RemoteContent.tsx b/pkg/interface/src/views/components/RemoteContent.tsx index 39ddb0e3f..33fda99da 100644 --- a/pkg/interface/src/views/components/RemoteContent.tsx +++ b/pkg/interface/src/views/components/RemoteContent.tsx @@ -51,7 +51,6 @@ class RemoteContent extends Component { } save = () => { - console.log(`saving for: ${this.props.url}`); if(this.saving) { return; } @@ -60,7 +59,6 @@ class RemoteContent extends Component { }; restore = () => { - console.log(`restoring for: ${this.props.url}`); this.saving = false; this.props.restore(); } diff --git a/pkg/interface/src/views/components/useTutorialModal.tsx b/pkg/interface/src/views/components/useTutorialModal.tsx index e9a2162ad..94aad20be 100644 --- a/pkg/interface/src/views/components/useTutorialModal.tsx +++ b/pkg/interface/src/views/components/useTutorialModal.tsx @@ -16,9 +16,7 @@ export function useTutorialModal( setTutorialRef(anchorRef.current); } - return () => { - console.log(tutorialProgress); - } + return () => {} }, [tutorialProgress, show, anchorRef]); return show && onProgress === tutorialProgress; diff --git a/pkg/interface/src/wdyr.js b/pkg/interface/src/wdyr.js new file mode 100644 index 000000000..db32b5d19 --- /dev/null +++ b/pkg/interface/src/wdyr.js @@ -0,0 +1,8 @@ +import React from 'react'; + +if (process.env.NODE_ENV === 'development') { + const whyDidYouRender = require('@welldone-software/why-did-you-render'); + whyDidYouRender(React, { + trackAllPureComponents: true, + }); +} \ No newline at end of file From 7f676822975edeeecd7bc8ca3c6a4f8e8d3d1456 Mon Sep 17 00:00:00 2001 From: Matilde Park Date: Thu, 11 Mar 2021 13:26:39 -0500 Subject: [PATCH 09/23] interface/css: remove non-existent fonts --- pkg/interface/src/views/css/fonts.css | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/pkg/interface/src/views/css/fonts.css b/pkg/interface/src/views/css/fonts.css index 9880e92de..1b50126e0 100644 --- a/pkg/interface/src/views/css/fonts.css +++ b/pkg/interface/src/views/css/fonts.css @@ -10,16 +10,14 @@ font-family: 'Inter'; font-style: normal; font-weight: 500; - src: url("/~landscape/fonts/inter-medium.woff2") format("woff2"), - url("https://media.urbit.org/fonts/Inter-Medium.woff2") format("woff2"); + src: url("https://media.urbit.org/fonts/Inter-Medium.woff2") format("woff2"); } @font-face { font-family: 'Inter'; font-style: normal; font-weight: 600; - src: url("/~landscape/fonts/inter-semibold.woff2") format("woff2"), - url("https://media.urbit.org/fonts/Inter-SemiBold.woff2") format("woff2"); + src: url("https://media.urbit.org/fonts/Inter-SemiBold.woff2") format("woff2"); } @font-face { From 3d46b16a264b621b89b6bc118deacfe8d1201ce3 Mon Sep 17 00:00:00 2001 From: Matilde Park Date: Thu, 11 Mar 2021 13:27:14 -0500 Subject: [PATCH 10/23] chat: key mapped components --- pkg/interface/src/views/apps/chat/components/ChatMessage.tsx | 5 ++++- pkg/interface/src/views/apps/chat/components/content/text.js | 4 ++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/pkg/interface/src/views/apps/chat/components/ChatMessage.tsx b/pkg/interface/src/views/apps/chat/components/ChatMessage.tsx index c3359bdf5..ee9d1c623 100644 --- a/pkg/interface/src/views/apps/chat/components/ChatMessage.tsx +++ b/pkg/interface/src/views/apps/chat/components/ChatMessage.tsx @@ -408,6 +408,7 @@ export const Message = ({ case 'text': return ( ); case 'code': - return ; + return ; case 'url': return ( (i === 0); return ( { }, []); return lines.map((line, i) => ( - <> + {i !== 0 && } { ] ]} /> - + )); }); From c44370889edd89cc963d28825b80955ef9eef4f7 Mon Sep 17 00:00:00 2001 From: Matilde Park Date: Thu, 11 Mar 2021 13:27:24 -0500 Subject: [PATCH 11/23] VirtualScroller: use correct style name --- pkg/interface/src/views/components/VirtualScroller.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkg/interface/src/views/components/VirtualScroller.tsx b/pkg/interface/src/views/components/VirtualScroller.tsx index f36fd0334..588633418 100644 --- a/pkg/interface/src/views/components/VirtualScroller.tsx +++ b/pkg/interface/src/views/components/VirtualScroller.tsx @@ -40,7 +40,7 @@ interface VirtualScrollerProps { data: BigIntOrderedMap; /** * The component to render the items - * + * * @remarks * * This component must be referentially stable, so either use `useCallback` or @@ -157,7 +157,7 @@ export default class VirtualScroller extends Component extends Component {!IS_IOS && ( { this.scrollRef = el; }} right="0" height="50px" position="absolute" width="4px" backgroundColor="lightGray" />)} - + {(isTop ? !atStart : !atEnd) && (
From 8b680cd1b855afbca691642a3ad98a40fd4ae4b8 Mon Sep 17 00:00:00 2001 From: Matilde Park Date: Thu, 11 Mar 2021 17:00:57 -0500 Subject: [PATCH 12/23] settings: fix sidebar spacing Fixes urbit/landscape#562 --- pkg/interface/src/views/apps/settings/settings.tsx | 4 ++-- pkg/interface/src/views/landscape/components/SidebarItem.tsx | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pkg/interface/src/views/apps/settings/settings.tsx b/pkg/interface/src/views/apps/settings/settings.tsx index eb0c37e6d..b2ae9f855 100644 --- a/pkg/interface/src/views/apps/settings/settings.tsx +++ b/pkg/interface/src/views/apps/settings/settings.tsx @@ -85,10 +85,10 @@ export default function SettingsScreen(props: any) { width='100%' overflowY='auto' > - + System Preferences - + From 0c766af3002ced09afdf91ae33ab6794a0410997 Mon Sep 17 00:00:00 2001 From: James Acklin Date: Thu, 11 Mar 2021 17:19:38 -0500 Subject: [PATCH 13/23] interface: minor fix grabbag --- .../apps/profile/components/EditProfile.tsx | 16 ++++++++-------- pkg/interface/src/views/components/StatusBar.js | 10 +++++----- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/pkg/interface/src/views/apps/profile/components/EditProfile.tsx b/pkg/interface/src/views/apps/profile/components/EditProfile.tsx index a8b774383..d59bd98a8 100644 --- a/pkg/interface/src/views/apps/profile/components/EditProfile.tsx +++ b/pkg/interface/src/views/apps/profile/components/EditProfile.tsx @@ -85,7 +85,7 @@ export function ProfileHeaderImageEdit(props: any): ReactElement { export function EditProfile(props: any): ReactElement { const { contact, ship, api } = props; - const isPublic = useContactState(state => state.isContactPublic); + const isPublic = useContactState((state) => state.isContactPublic); const [hideCover, setHideCover] = useState(false); const handleHideCover = (value) => { @@ -150,7 +150,7 @@ export function EditProfile(props: any): ReactElement {
- +