Skip to content

Commit

Permalink
Merge pull request #2 from jhnnsrs/with_next
Browse files Browse the repository at this point in the history
With next
  • Loading branch information
jhnnsrs authored Aug 25, 2023
2 parents 131692d + 8d51d9b commit c977a69
Show file tree
Hide file tree
Showing 248 changed files with 4,273 additions and 3,989 deletions.
148 changes: 148 additions & 0 deletions graphql/lok/fragments/comment.graphql
Original file line number Diff line number Diff line change
@@ -0,0 +1,148 @@
fragment Leaf on Leaf {
typename: __typename
bold
italic
code
text
}

fragment Node on CommentNode {
typename: __typename
children {
typename: __typename
...Leaf
...LevelDownParagraph
...LevelDownMention
}
}

fragment LevelDownParagraph on ParagraphDescendent {
size
untypedChildren
}

fragment LevelDownMention on MentionDescendent {
user {
...CommentUser
}
}

fragment LevelDownDescendent on Descendent {
typename: __typename
...Leaf
}

fragment Mention on MentionDescendent {
user {
...CommentUser
}
...Node
}

fragment CommentUser on User {
id
username
profile {
avatar
}
}

fragment Paragraph on ParagraphDescendent {
size
...Node
}

fragment Descendent on Descendent {
typename: __typename

...Mention
...Paragraph
...Leaf
}

fragment SubthreadComment on Comment {
user {
...CommentUser
}
parent {
id
}
createdAt
descendents {
...Descendent
}
}

fragment ListComment on Comment {
user {
...CommentUser
}
parent {
id
}
descendents {
...Descendent
}
resolved
resolvedBy {
...CommentUser
}
id
createdAt
children {
...SubthreadComment
}
}

fragment MentionComment on Comment {
user {
...CommentUser
}
parent {
id
}
descendents {
...Descendent
}
id
createdAt
children {
...SubthreadComment
}
mentions {
...CommentUser
}
resolved
resolvedBy {
...CommentUser
}
object
identifier
}

fragment DetailComment on Comment {
user {
...CommentUser
}
parent {
id
}
descendents {
...Descendent
}
id

resolved
resolvedBy {
...CommentUser
}
createdAt
children {
...SubthreadComment
}
mentions {
...CommentUser
}
object
identifier
}
6 changes: 3 additions & 3 deletions graphql/lok/fragments/user.graphql
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
fragment ListUser on HerreUser {
fragment ListUser on User {
username
firstName
lastName
Expand All @@ -9,7 +9,7 @@ fragment ListUser on HerreUser {
id
}

fragment DetailUser on HerreUser {
fragment DetailUser on User {
id
username
email
Expand All @@ -25,7 +25,7 @@ fragment DetailUser on HerreUser {
}
}

fragment MeUser on HerreUser {
fragment MeUser on User {
id
username
roles
Expand Down
27 changes: 27 additions & 0 deletions graphql/lok/mutations/comment.graphql
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
mutation CreateComment(
$object: ID!
$identifier: String!
$descendents: [DescendendInput]!
$parent: ID
) {
createComment(
object: $object
identifier: $identifier
descendents: $descendents
parent: $parent
) {
...ListComment
}
}

mutation ReplyTo($descendents: [DescendendInput]!, $parent: ID!) {
replyTo(descendents: $descendents, parent: $parent) {
...ListComment
}
}

mutation ResolveComment($id: ID!) {
resolveComment(id: $id) {
...ListComment
}
}
17 changes: 17 additions & 0 deletions graphql/lok/queries/comments.graphql
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
query CommentsFor($object: ID!, $identifier: String!) {
commentsfor(identifier: $identifier, object: $object) {
...ListComment
}
}

query MyMentions {
mymentions {
...MentionComment
}
}

query DetailComment($id: ID!) {
comment(id: $id) {
...DetailComment
}
}
10 changes: 10 additions & 0 deletions graphql/lok/subscriptions/mentions.graphql
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
subscription WatchMentions {
mymentions {
create {
...MentionComment
}
update {
...MentionComment
}
}
}
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"@headlessui/react": "^1.5.0",
"@heroicons/react": "^1.0.6",
"@jhnnsrs/datalayer": "0.0.7",
"@jhnnsrs/fakts": "0.1.10",
"@jhnnsrs/fakts": "0.1.15",
"@jhnnsrs/herre": "0.0.11",
"@popperjs/core": "^2.11.5",
"@radix-ui/react-dialog": "^1.0.4",
Expand Down Expand Up @@ -104,6 +104,7 @@
"react-use-websocket": "^4.2.0",
"reactflow": "^11.5.6",
"remark-gfm": "^3.0.1",
"rxjs": "^7.8.1",
"simple-statistics": "^7.7.6",
"slate": "^0.81.1",
"slate-react": "^0.81.0",
Expand Down
4 changes: 2 additions & 2 deletions src/actions/NodeActions.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from "react";
import { useNavigate } from "react-router";
import { ActionButton } from "../layout/ActionButton";
import { Reservation } from "../linker";
import { RekuestReservation } from "../linker";
import { withRekuest } from "../rekuest";
import { useDeleteNodeMutation } from "../rekuest/api/graphql";
import { useReserver } from "../rekuest/providers/reserver/reserver-context";
Expand All @@ -21,7 +21,7 @@ export const NodeActions: React.FC<NodeActionsProps> = (props) => {
const handlereserve = async () => {
if (props.node?.id) {
let x = await reserve({ node: props.node.id });
x?.id && (await navigate(Reservation.linkBuilder(x.id)));
x?.id && (await navigate(RekuestReservation.linkBuilder(x.id)));
}
};

Expand Down
21 changes: 2 additions & 19 deletions src/app/AppProvider.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import { DatalayerProvider } from "@jhnnsrs/datalayer";
import { FaktsProvider } from "@jhnnsrs/fakts";
import { HerreProvider, windowRedirect } from "@jhnnsrs/herre";
import { listen } from "@tauri-apps/api/event";
import { open } from "@tauri-apps/api/shell";
import React from "react";
import { FlussProvider } from "../fluss/fluss-provider";
import { LokProvider } from "../lok/LokProvider";
Expand All @@ -15,27 +13,12 @@ import { PostmanProvider } from "../rekuest/providers/postman/postman-provider";
import { RequesterProvider } from "../rekuest/providers/requester/requester-provider";
import { ReserverProvider } from "../rekuest/providers/reserver/reserver-provider";
import { WidgetRegistryProvider } from "../rekuest/widgets/widget-provider";
import { tauriRedirect } from "../tauri/funcs";

const doRedirect = async (url: string, abortController: AbortController) => {
console.log("Redirecting to", url);
if (window.__TAURI__) {
console.log("Tauri detected");
open(url);

return new Promise<string>((resolve, reject) => {
console.log("Listening for code");
const unlisten = listen("oauth://url", async (event) => {
let url = event.payload as string;
let code = url.split("code=")[1];
console.log("Got code", code);
resolve(code);
});

const unlistend = listen("oauth://invalid-url", async (event) => {
console.log("Got invalid-rl", event);
reject(event);
});
});
return await tauriRedirect(url, abortController);
} else {
return await windowRedirect(url, abortController);
}
Expand Down
19 changes: 13 additions & 6 deletions src/app/AutoConfiguration.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,20 @@ import { MikroWard } from "../bridges/MikroWard";
import { PortAutoConfigure } from "../bridges/PortAutoConfigure";
import { RekuestAutoConfigure } from "../bridges/RekuestAutoConfigure";
import { RekuestWard } from "../bridges/RekuestWard";
import { TauriHerreCallback } from "../bridges/TauriHerreCallback";
import { StaticEndpoints } from "../bridges/StaticEndpoints";
import { TauriFaktsSearcher } from "../bridges/TauriFaktsSearcher";
import { GeneralMenu } from "../components/command/GeneralMenu";
import { NavigationActions } from "../components/command/NavigationActions";
import { NodesExtension } from "../components/command/NodesExtension";
import { SearchActions } from "../components/command/SearchActions";
import { SelectionActions } from "../components/command/SelectionActions";
import { ConfirmModal } from "../components/confirmer/ConfirmModal";
import { notEmpty } from "../floating/utils";
import { FlussWard } from "../fluss/ward";
import { DialogDisplay } from "../layout/dialog/Dialog";
import { LokGuard } from "../lok/LokGuard";
import { MentionListener } from "../lok/komment/listeners/MentionListener";
import { MikroGuard } from "../mikro/MikroGuard";
import { MentionListener } from "../mikro/listeners/MentionListener";
import { withRekuest } from "../rekuest";
import { RekuestGuard } from "../rekuest/RekuestGuard";
import {
Expand Down Expand Up @@ -115,6 +118,7 @@ export const AutoConfiguration = () => {
<DatalayerAutoConfigure />
<LokAutoConfigure />
<FlussAutoConfigure />
<ConfirmModal />

<FlussWard />
<MikroNextWard />
Expand All @@ -126,19 +130,22 @@ export const AutoConfiguration = () => {
<DndPreview />
<GeneralMenu />
<NavigationActions />
<LokGuard>
<MentionListener />
</LokGuard>
<MikroGuard>
<MikroWard />
<SearchActions />
<MentionListener />
</MikroGuard>
<TauriGuard>
<TauriFaktsSearcher />
</TauriGuard>
<StaticEndpoints endpoints={["http://localhost:8000"]} />
<RekuestGuard>
<RekuestWard />
<NodesExtension />
<GraphQLPostman onAssignUpdate={onAssignUpdate} />
</RekuestGuard>
<TauriGuard>
<TauriHerreCallback />
</TauriGuard>
<SelectionActions />
</>
);
Expand Down
Loading

0 comments on commit c977a69

Please sign in to comment.