Merge branch 'release/next-userspace' into lf/hark-redux

This commit is contained in:
Matilde Park 2020-11-03 12:31:10 -05:00
commit 3a1c3117c0
14 changed files with 28 additions and 48 deletions

View File

@ -87,7 +87,7 @@ export function getLatestRevision(node: GraphNode): [number, string, string, Pos
return empty return empty
} }
const [title, body] = rev.post.contents as TextContent[]; const [title, body] = rev.post.contents as TextContent[];
return [revNum, title.text, body.text, rev.post]; return [revNum.toJSNumber(), title.text, body.text, rev.post];
} }
export function getComments(node: GraphNode): GraphNode { export function getComments(node: GraphNode): GraphNode {

View File

@ -9,13 +9,8 @@ export * from './graph-update';
export * from './hark-update'; export * from './hark-update';
export * from './invite-update'; export * from './invite-update';
export * from './launch-update'; export * from './launch-update';
export * from './link-listen-update';
export * from './link-update';
export * from './local-update'; export * from './local-update';
export * from './metadata-update'; export * from './metadata-update';
export * from './noun'; export * from './noun';
export * from './permission-update';
export * from './publish-response';
export * from './publish-update';
export * from './s3-update'; export * from './s3-update';
export * from './workspace'; export * from './workspace';

View File

@ -18,9 +18,6 @@ export const UnreadMarker = React.forwardRef(({ dayBreak, when }, ref) => (
<Rule borderColor='blue' display={['none', 'block']} m='0' width='2rem' /> <Rule borderColor='blue' display={['none', 'block']} m='0' width='2rem' />
<Text flexShrink='0' display='block' zIndex='2' mx='4' color='blue'>New messages below</Text> <Text flexShrink='0' display='block' zIndex='2' mx='4' color='blue'>New messages below</Text>
<Rule borderColor='blue' flexGrow='1' m='0'/> <Rule borderColor='blue' flexGrow='1' m='0'/>
{dayBreak
? <Text display='block' gray mx='4'>{moment(when).calendar(null, { sameElse: DATESTAMP_FORMAT })}</Text>
: null}
<Rule style={{ width: "calc(50% - 48px)" }} borderColor='blue' m='0' /> <Rule style={{ width: "calc(50% - 48px)" }} borderColor='blue' m='0' />
</Row> </Row>
)); ));
@ -94,7 +91,7 @@ export default class ChatMessage extends Component<ChatMessageProps> {
const dayBreak = nextMsg && new Date(msg.when).getDate() !== new Date(nextMsg.when).getDate(); const dayBreak = nextMsg && new Date(msg.when).getDate() !== new Date(nextMsg.when).getDate();
const containerClass = `${renderSigil const containerClass = `${renderSigil
? `cf pt2 pl3 lh-copy` ? `cf pl2 lh-copy`
: `items-top cf hide-child`} ${isPending ? 'o-40' : ''} ${className}` : `items-top cf hide-child`} ${isPending ? 'o-40' : ''} ${className}`
const timestamp = moment.unix(msg.when / 1000).format(renderSigil ? 'hh:mm a' : 'hh:mm'); const timestamp = moment.unix(msg.when / 1000).format(renderSigil ? 'hh:mm a' : 'hh:mm');
@ -130,6 +127,7 @@ export default class ChatMessage extends Component<ChatMessageProps> {
width='100%' width='100%'
display='flex' display='flex'
flexWrap='wrap' flexWrap='wrap'
pt={renderSigil ? 3 : 0}
pr={3} pr={3}
pb={isLastMessage ? 3 : 0} pb={isLastMessage ? 3 : 0}
ref={this.divRef} ref={this.divRef}
@ -229,6 +227,7 @@ export class MessageWithSigil extends PureComponent<MessageProps> {
fontSize={0} fontSize={0}
mr={3} mr={3}
mono={!showNickname} mono={!showNickname}
fontWeight={(showNickname) ? '500' : '400'}
className={`mw5 db truncate pointer`} className={`mw5 db truncate pointer`}
ref={e => nameSpan = e} ref={e => nameSpan = e}
onClick={() => { onClick={() => {
@ -249,7 +248,7 @@ export class MessageWithSigil extends PureComponent<MessageProps> {
export const MessageWithoutSigil = ({ timestamp, msg, remoteContentPolicy, measure }) => ( export const MessageWithoutSigil = ({ timestamp, msg, remoteContentPolicy, measure }) => (
<> <>
<Text mono gray display='inline-block' pr='1' pt='2px' lineHeight='tall' className="child">{timestamp}</Text> <Text mono gray display='inline-block' pt='2px' lineHeight='tall' className="child">{timestamp}</Text>
<Box fontSize='14px' className="clamp-message" style={{ flexGrow: 1 }}> <Box fontSize='14px' className="clamp-message" style={{ flexGrow: 1 }}>
<MessageContent content={msg.letter} remoteContentPolicy={remoteContentPolicy} measure={measure}/> <MessageContent content={msg.letter} remoteContentPolicy={remoteContentPolicy} measure={measure}/>
</Box> </Box>

View File

@ -15,6 +15,7 @@ export default class CodeContent extends Component {
mono mono
p='1' p='1'
my='0' my='0'
borderRadius='1'
fontSize='14px' fontSize='14px'
overflow='auto' overflow='auto'
maxHeight='10em' maxHeight='10em'
@ -33,6 +34,7 @@ export default class CodeContent extends Component {
mono mono
my='0' my='0'
p='1' p='1'
borderRadius='1'
fontSize='14px' fontSize='14px'
overflow='auto' overflow='auto'
maxHeight='10em' maxHeight='10em'

View File

@ -30,10 +30,11 @@ const renderers = {
}, },
code: ({language, value}) => { code: ({language, value}) => {
return <Text return <Text
py='1' p='1'
className='clamp-message' className='clamp-message'
fontSize='14px' fontSize='14px'
display='block' display='block'
borderRadius='1'
mono mono
backgroundColor='washedGray' backgroundColor='washedGray'
overflowX='scroll' overflowX='scroll'

View File

@ -29,12 +29,6 @@ export default class LaunchApp extends React.Component {
render() { render() {
const { props } = this; const { props } = this;
const contact = props.contacts?.['/~/default']?.[window.ship];
const sigilColor = contact?.color
? `#${uxToHex(contact.color)}`
: props.dark
? '#FFFFFF'
: '#000000';
return ( return (
<> <>
@ -67,15 +61,6 @@ export default class LaunchApp extends React.Component {
</Row> </Row>
</Box> </Box>
</Tile> </Tile>
<Tile
borderColor={adjustHex(sigilColor, -40)}
bg={sigilColor}
to="/~profile"
>
<Center height="100%">
<Sigil ship={`~${window.ship}`} size={80} color={sigilColor} />
</Center>
</Tile>
<Tiles <Tiles
tiles={props.launch.tiles} tiles={props.launch.tiles}
tileOrdering={props.launch.tileOrdering} tileOrdering={props.launch.tileOrdering}

View File

@ -46,7 +46,7 @@ export default class Tile extends React.Component {
borderRadius={2} borderRadius={2}
overflow="hidden" overflow="hidden"
bg={bg || "white"} bg={bg || "white"}
color={props?.color || 'washedGray'} color={props?.color || 'scales.black20'}
boxShadow={boxShadow || '0 0 0px 1px inset'} boxShadow={boxShadow || '0 0 0px 1px inset'}
> >
<Box <Box

View File

@ -77,7 +77,7 @@ export function GroupSwitcher(props: {
baseUrl: string; baseUrl: string;
recentGroups: string[]; recentGroups: string[];
}) { }) {
const { associations, workspace } = props; const { associations, workspace, isAdmin } = props;
const title = getTitleFromWorkspace(associations, workspace); const title = getTitleFromWorkspace(associations, workspace);
const navTo = (to: string) => `${props.baseUrl}${to}`; const navTo = (to: string) => `${props.baseUrl}${to}`;
return ( return (
@ -152,14 +152,14 @@ export function GroupSwitcher(props: {
/> />
<Text> Group Settings</Text> <Text> Group Settings</Text>
</GroupSwitcherItem> </GroupSwitcherItem>
<GroupSwitcherItem bottom to={navTo("/invites")}> {isAdmin && (<GroupSwitcherItem bottom to={navTo("/invites")}>
<Icon <Icon
mr={2} mr={2}
color="blue" color="blue"
icon="CreateGroup" icon="Users"
/> />
<Text color="blue">Invite to group</Text> <Text color="blue">Invite to group</Text>
</GroupSwitcherItem> </GroupSwitcherItem>)}
</> </>
)} )}
</Col> </Col>
@ -173,15 +173,15 @@ export function GroupSwitcher(props: {
</Row> </Row>
</Dropdown> </Dropdown>
<Row pr={1} justifyContent="flex-end" alignItems="center"> <Row pr={1} justifyContent="flex-end" alignItems="center">
{workspace.type === "group" && ( {(workspace.type === "group") && (
<> <>
<Link to={navTo("/invites")}> {isAdmin && (<Link to={navTo("/invites")}>
<Icon <Icon
display="block" display="block"
color='blue' color='blue'
icon="CreateGroup" icon="Users"
/> />
</Link> </Link>)}
<Link to={navTo("/popover/settings")}> <Link to={navTo("/popover/settings")}>
<Icon color='gray' display="block" m={2} icon="Gear" /> <Icon color='gray' display="block" m={2} icon="Gear" />
</Link> </Link>

View File

@ -82,7 +82,7 @@ export function GroupsPane(props: GroupsPaneProps) {
workspace={workspace} workspace={workspace}
/> />
</> </>
) )
return ( return (
<Switch> <Switch>
@ -170,6 +170,7 @@ export function GroupsPane(props: GroupsPaneProps) {
<NewChannel <NewChannel
{...routeProps} {...routeProps}
api={api} api={api}
baseUrl={baseUrl}
associations={associations} associations={associations}
groups={groups} groups={groups}
group={groupPath} group={groupPath}

View File

@ -108,6 +108,9 @@ export function NewChannel(props: NewChannelProps & RouteComponentProps) {
}; };
return ( return (
<Col overflowY="auto" p={3}> <Col overflowY="auto" p={3}>
<Box pb='3' display={['block', 'none']} onClick={() => history.push(props.baseUrl)}>
{'<- Back'}
</Box>
<Box fontWeight="bold" mb={4} color="black"> <Box fontWeight="bold" mb={4} color="black">
New Channel New Channel
</Box> </Box>

View File

@ -87,7 +87,7 @@ export function Sidebar(props: SidebarProps) {
const [config, setConfig] = useLocalStorageState<SidebarListConfig>( const [config, setConfig] = useLocalStorageState<SidebarListConfig>(
`group-config:${groupPath || "home"}`, `group-config:${groupPath || "home"}`,
{ {
sortBy: "asc", sortBy: "lastUpdated",
hideUnjoined: false, hideUnjoined: false,
} }
); );
@ -97,10 +97,6 @@ export function Sidebar(props: SidebarProps) {
const role = props.groups?.[groupPath] ? roleForShip(props.groups[groupPath], window.ship) : undefined; const role = props.groups?.[groupPath] ? roleForShip(props.groups[groupPath], window.ship) : undefined;
const isAdmin = (role === "admin") || (workspace?.type === 'home'); const isAdmin = (role === "admin") || (workspace?.type === 'home');
const newStyle = {
display: isAdmin ? "block" : "none"
};
return ( return (
<Col <Col
display={display} display={display}
@ -119,6 +115,7 @@ export function Sidebar(props: SidebarProps) {
associations={associations} associations={associations}
recentGroups={props.recentGroups} recentGroups={props.recentGroups}
baseUrl={props.baseUrl} baseUrl={props.baseUrl}
isAdmin={isAdmin}
workspace={props.workspace} workspace={props.workspace}
/> />
<SidebarListHeader <SidebarListHeader
@ -142,7 +139,7 @@ export function Sidebar(props: SidebarProps) {
<SidebarStickySpacer flexShrink={0} /> <SidebarStickySpacer flexShrink={0} />
<Box <Box
flexShrink="0" flexShrink="0"
display="flex" display={isAdmin ? "flex" : "none"}
justifyContent="center" justifyContent="center"
position="sticky" position="sticky"
bottom={"8px"} bottom={"8px"}
@ -151,7 +148,6 @@ export function Sidebar(props: SidebarProps) {
py="2" py="2"
> >
<Link <Link
style={newStyle}
to={!!groupPath ? `/~landscape${groupPath}/new` : `/~landscape/home/new`} to={!!groupPath ? `/~landscape${groupPath}/new` : `/~landscape/home/new`}
> >
<Box <Box

View File

@ -31,8 +31,7 @@ function sidebarSort(
return { return {
asc: alphabetical, asc: alphabetical,
desc: (a, b) => alphabetical(b, a), lastUpdated
lastUpdated,
}; };
} }

View File

@ -87,7 +87,6 @@ export function SidebarListHeader(props: {
<Text color="gray">Sort Order</Text> <Text color="gray">Sort Order</Text>
</Box> </Box>
<Radio mb="1" label="A -> Z" id="asc" name="sortBy" /> <Radio mb="1" label="A -> Z" id="asc" name="sortBy" />
<Radio mb="1" label="Z -> A" id="desc" name="sortBy" />
<Radio label="Last Updated" id="lastUpdated" name="sortBy" /> <Radio label="Last Updated" id="lastUpdated" name="sortBy" />
</Col> </Col>
<Col px={2}> <Col px={2}>

View File

@ -5,7 +5,7 @@ export type SidebarItemStatus =
| "disconnected" | "disconnected"
| "loading"; | "loading";
export type SidebarSort = "asc" | "desc" | "lastUpdated"; export type SidebarSort = "asc" | "lastUpdated";
export interface SidebarListConfig { export interface SidebarListConfig {
sortBy: SidebarSort; sortBy: SidebarSort;