mirror of
https://github.com/urbit/shrub.git
synced 2024-12-01 06:35:32 +03:00
Merge branch 'dist' of github.com:urbit/urbit into dist
This commit is contained in:
commit
e39f1270e5
@ -8,6 +8,7 @@ import { ShipName } from '../../components/ShipName';
|
||||
import { DeskLink } from '../../components/DeskLink';
|
||||
import { useHarkStore } from '../../state/hark';
|
||||
import { DocketImage } from '../../components/DocketImage';
|
||||
import { Button } from '../../components/Button';
|
||||
|
||||
interface BasicNotificationProps {
|
||||
notification: Notification;
|
||||
@ -45,13 +46,19 @@ export const BasicNotification = ({ notification, lid }: BasicNotificationProps)
|
||||
useHarkStore.getState().archiveNote(notification.bin, lid);
|
||||
};
|
||||
|
||||
const archiveNoFollow = (e: React.MouseEvent<HTMLButtonElement>) => {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
archive();
|
||||
};
|
||||
|
||||
return (
|
||||
<DeskLink
|
||||
onClick={archive}
|
||||
to={`?grid-note=${encodeURIComponent(first.link)}`}
|
||||
desk={desk}
|
||||
className={cn(
|
||||
'text-black rounded-xl',
|
||||
'text-black rounded-xl group',
|
||||
'unseen' in lid ? 'bg-blue-100' : 'bg-gray-50',
|
||||
large ? 'note-grid-no-content' : 'note-grid-content'
|
||||
)}
|
||||
@ -64,6 +71,9 @@ export const BasicNotification = ({ notification, lid }: BasicNotificationProps)
|
||||
<h2 id={`${id}-title`} className="note-grid-head font-semibold text-gray-600">
|
||||
<NotificationText contents={first.title} />
|
||||
</h2>
|
||||
<div className="note-grid-actions hidden justify-center self-center group-hover:flex">
|
||||
<Button onClick={archiveNoFollow}>Archive</Button>
|
||||
</div>
|
||||
</header>
|
||||
{contents.length > 0 ? (
|
||||
<div className="note-grid-body space-y-2">
|
||||
|
@ -84,6 +84,14 @@ export const useHarkStore = createState<HarkState>(
|
||||
await api.poke(archiveAll);
|
||||
},
|
||||
archiveNote: async (bin, lid) => {
|
||||
if (useMockData) {
|
||||
get().set((draft) => {
|
||||
const seen = 'seen' in lid ? 'seen' : 'unseen';
|
||||
const binId = harkBinToId(bin);
|
||||
delete draft[seen][binId];
|
||||
});
|
||||
return;
|
||||
}
|
||||
await api.poke(archive(bin, lid));
|
||||
},
|
||||
opened: async () => {
|
||||
|
@ -1,13 +1,13 @@
|
||||
.note-grid-content {
|
||||
display: grid;
|
||||
grid-template-columns: 1.5rem 1fr;
|
||||
grid-template-columns: 1.5rem 1fr 6rem;
|
||||
grid-template-rows: 1.5rem 1.5rem;
|
||||
grid-gap: 0.5rem;
|
||||
padding: 1rem;
|
||||
grid-template-areas:
|
||||
'icon title'
|
||||
'arrow head'
|
||||
'. body';
|
||||
'icon title actions '
|
||||
'arrow head actions'
|
||||
'. body actions';
|
||||
}
|
||||
|
||||
.note-grid-no-content {
|
||||
@ -15,12 +15,12 @@
|
||||
width: 100%;
|
||||
padding: 1rem;
|
||||
grid-template-rows: 1.75rem 1.75rem;
|
||||
grid-template-columns: 3.5rem 1fr;
|
||||
grid-template-columns: 3.5rem 1fr 6rem;
|
||||
grid-column-gap: 0.75rem;
|
||||
align-items: center;
|
||||
grid-template-areas:
|
||||
'icon title'
|
||||
'icon head';
|
||||
'icon title actions'
|
||||
'icon head actions';
|
||||
}
|
||||
.note-grid-title {
|
||||
grid-area: title;
|
||||
@ -42,4 +42,6 @@
|
||||
grid-area: head;
|
||||
}
|
||||
|
||||
|
||||
.note-grid-actions {
|
||||
grid-area: actions;
|
||||
}
|
||||
|
@ -200,7 +200,8 @@ module.exports = {
|
||||
},
|
||||
variants: {
|
||||
extend: {
|
||||
opacity: ['hover-none']
|
||||
opacity: ['hover-none'],
|
||||
display: ['group-hover']
|
||||
}
|
||||
},
|
||||
plugins: [
|
||||
|
@ -19,7 +19,6 @@ import GroupSearch from '~/views/components/GroupSearch';
|
||||
import { ImageInput } from '~/views/components/ImageInput';
|
||||
import {
|
||||
ProfileControls, ProfileHeader,
|
||||
|
||||
ProfileImages, ProfileStatus
|
||||
} from './Profile';
|
||||
import airlock from '~/logic/api';
|
||||
@ -96,7 +95,7 @@ export function EditProfile(props: any): ReactElement {
|
||||
const newValue = key !== 'color' ? values[key] : uxToHex(values[key]);
|
||||
if (newValue !== contact[key]) {
|
||||
if (key === 'isPublic') {
|
||||
airlock.poke(setPublic(true));
|
||||
airlock.poke(setPublic(newValue));
|
||||
return;
|
||||
} else if (key === 'groups') {
|
||||
const toRemove: string[] = _.difference(
|
||||
|
@ -104,8 +104,7 @@ export function JoinGroup(props: JoinGroupProps): ReactElement {
|
||||
history.push(`/~landscape${group}`);
|
||||
}
|
||||
} catch (e) {
|
||||
// drop them into inbox to show join request still pending
|
||||
history.push('/~notifications');
|
||||
console.error(e);
|
||||
}
|
||||
}, [waiter, history, associations, groups]);
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
import React, { ReactElement, useCallback } from 'react';
|
||||
import { Associations, Graph } from '@urbit/api';
|
||||
import { patp, patp2dec } from 'urbit-ob';
|
||||
import _ from 'lodash';
|
||||
|
||||
import { SidebarAssociationItem, SidebarDmItem } from './SidebarItem';
|
||||
import useGraphState, { useInbox } from '~/logic/state/graph';
|
||||
@ -86,7 +87,7 @@ function getItems(associations: Associations, workspace: Workspace, inbox: Graph
|
||||
? []
|
||||
: Array.from(pending).map(s => `~${s}`);
|
||||
|
||||
return [...filtered, ...direct, ...pend];
|
||||
return [...filtered, ..._.union(direct, pend)];
|
||||
}
|
||||
|
||||
export function SidebarList(props: {
|
||||
|
@ -193,7 +193,8 @@
|
||||
++ jn-start
|
||||
|= [rid=resource =^ship]
|
||||
^+ jn-core
|
||||
?< (~(has by joining) rid)
|
||||
?> ?= $@(~ [~ %done])
|
||||
(bind (~(get by joining) rid) |=(request:view progress))
|
||||
=. joining
|
||||
(~(put by joining) rid [%.n now.bowl ship %start])
|
||||
=. jn-core
|
||||
|
@ -1,5 +1,5 @@
|
||||
|
||||
import { Path, Patp, Poke, resourceAsPath, Scry } from "../lib";
|
||||
import { Patp, Poke, Scry } from '../lib';
|
||||
import {
|
||||
Contact,
|
||||
ContactUpdateAdd,
|
||||
@ -10,36 +10,36 @@ import {
|
||||
ContactUpdate,
|
||||
ContactUpdateAllowShips,
|
||||
ContactUpdateAllowGroup,
|
||||
ContactUpdateSetPublic,
|
||||
} from "./types";
|
||||
ContactUpdateSetPublic
|
||||
} from './types';
|
||||
|
||||
export const CONTACT_UPDATE_VERSION: number = 0;
|
||||
export const CONTACT_UPDATE_VERSION = 0;
|
||||
|
||||
const storeAction = <T extends ContactUpdate>(data: T, version: number = CONTACT_UPDATE_VERSION): Poke<T> => ({
|
||||
app: "contact-store",
|
||||
app: 'contact-store',
|
||||
mark: `contact-update-${version}`,
|
||||
json: data,
|
||||
json: data
|
||||
});
|
||||
|
||||
export { storeAction as contactStoreAction };
|
||||
|
||||
export const addContact = (ship: Patp, contact: Contact): Poke<ContactUpdateAdd> => {
|
||||
contact["last-updated"] = Date.now();
|
||||
contact['last-updated'] = Date.now();
|
||||
|
||||
return storeAction({
|
||||
add: { ship, contact },
|
||||
add: { ship, contact }
|
||||
});
|
||||
};
|
||||
|
||||
export const removeContact = (ship: Patp): Poke<ContactUpdateRemove> =>
|
||||
storeAction({
|
||||
remove: { ship },
|
||||
remove: { ship }
|
||||
});
|
||||
|
||||
export const share = (recipient: Patp, version: number = CONTACT_UPDATE_VERSION): Poke<ContactShare> => ({
|
||||
app: "contact-push-hook",
|
||||
mark: "contact-share",
|
||||
json: { share: recipient },
|
||||
app: 'contact-push-hook',
|
||||
mark: 'contact-share',
|
||||
json: { share: recipient }
|
||||
});
|
||||
|
||||
export const editContact = (
|
||||
@ -49,9 +49,9 @@ export const editContact = (
|
||||
storeAction({
|
||||
edit: {
|
||||
ship,
|
||||
"edit-field": editField,
|
||||
timestamp: Date.now(),
|
||||
},
|
||||
'edit-field': editField,
|
||||
timestamp: Date.now()
|
||||
}
|
||||
});
|
||||
|
||||
export const allowShips = (
|
||||
@ -67,7 +67,7 @@ export const allowGroup = (
|
||||
name: string
|
||||
): Poke<ContactUpdateAllowGroup> => storeAction({
|
||||
allow: {
|
||||
group: resourceAsPath({ ship, name })
|
||||
group: { ship, name }
|
||||
}
|
||||
});
|
||||
|
||||
@ -77,7 +77,7 @@ export const setPublic = (
|
||||
return storeAction({
|
||||
'set-public': setPublic
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
export const retrieve = (
|
||||
ship: string
|
||||
@ -93,7 +93,7 @@ export const retrieve = (
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
export const fetchIsAllowed = (
|
||||
entity: string,
|
||||
@ -105,5 +105,5 @@ export const fetchIsAllowed = (
|
||||
return {
|
||||
app: 'contact-store',
|
||||
path: `/is-allowed/${entity}/${name}/${ship}/${isPersonal}`
|
||||
}
|
||||
};
|
||||
};
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { Path, Patp } from "../lib";
|
||||
import { Resource } from "../groups";
|
||||
import { Path, Patp } from '../lib';
|
||||
import { Resource } from '../groups';
|
||||
|
||||
export type ContactUpdate =
|
||||
| ContactUpdateAdd
|
||||
@ -26,7 +26,7 @@ export interface ContactUpdateRemove {
|
||||
export interface ContactUpdateEdit {
|
||||
edit: {
|
||||
ship: Patp;
|
||||
"edit-field": ContactEditField;
|
||||
'edit-field': ContactEditField;
|
||||
timestamp: number;
|
||||
};
|
||||
}
|
||||
@ -39,7 +39,7 @@ export interface ContactUpdateAllowShips {
|
||||
|
||||
export interface ContactUpdateAllowGroup {
|
||||
allow: {
|
||||
group: Path;
|
||||
group: Resource;
|
||||
}
|
||||
}
|
||||
|
||||
@ -74,7 +74,7 @@ export interface Contact {
|
||||
|
||||
type ContactKeys = keyof Contact;
|
||||
|
||||
export type ContactEditFieldPrim = Exclude<ContactKeys, "groups" | "last-updated">;
|
||||
export type ContactEditFieldPrim = Exclude<ContactKeys, 'groups' | 'last-updated'>;
|
||||
|
||||
export type ContactEditField = Partial<Pick<Contact, ContactEditFieldPrim>> & {
|
||||
'add-group'?: Resource;
|
||||
|
Loading…
Reference in New Issue
Block a user