-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ae5a7ac
commit a759cab
Showing
14 changed files
with
701 additions
and
507 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
import { signOut } from "next-auth/react"; | ||
import fetchJson from "@/lib/iron-session/fetchJson"; | ||
import { createPost } from "@/lib/editor/createPost"; | ||
import { savePost } from "@/lib/editor/savePost"; | ||
import { getUserArticle } from "@/lib/api"; | ||
// import { loggedInMenu } from "./menus/loggedInMenu"; | ||
|
||
export const typrNotesProps = ({ user, userLoading, mutateUser, router }) => ({ | ||
enablePublishingFlow: true, | ||
theme: "blue", | ||
editorWidth: "590px", | ||
components: { | ||
nav: { | ||
show:true, | ||
undoRedoButtons: { show: false }, | ||
logo: { show:false,image: `/static/images/logo-small.svg`, url: "/" }, | ||
userBadge: { | ||
show:false, | ||
// loggedInMenu | ||
}, | ||
position: "sticky", | ||
}, | ||
userMenu: { | ||
avatarPlaceholder: | ||
"https://prototypr-media.sfo2.digitaloceanspaces.com/strapi/4f9713374ad556ff3b8ca33e241f6c43.png?updated_at=2022-12-14T10:55:38.818Z", | ||
}, | ||
settingsPanel: { | ||
featuredImage: { | ||
show:true | ||
}, | ||
}, | ||
}, | ||
user: { | ||
id: user?.id, | ||
slug: user?.profile?.slug, | ||
avatar: user?.profile?.avatar?.url, | ||
isLoggedIn: user?.isLoggedIn, | ||
isAdmin: user?.isAdmin, | ||
loading: userLoading, | ||
jwt: user?.jwt, | ||
signOut: async () => { | ||
await signOut({ redirect: false }); | ||
mutateUser( | ||
await fetchJson("/api/auth/logout", { method: "POST" }), | ||
false | ||
); | ||
}, | ||
}, | ||
postOperations: { | ||
load: async ({ postId, user }) => { | ||
const postObject = await getUserArticle({user, id:postId, type: "note"}); | ||
return postObject; | ||
}, | ||
save: async ({ entry, postId }) => { | ||
const postObject = await savePost({ entry, postId, user }); | ||
return postObject; | ||
}, | ||
create: async ({ entry }) => { | ||
const postObject = await createPost({ entry, user, type: "note" }); | ||
return postObject; | ||
}, | ||
}, | ||
mediaHandler:{ | ||
config: { | ||
method: "post", | ||
url: `${process.env.NEXT_PUBLIC_API_URL}/api/users-permissions/users/article/image/upload`, | ||
headers: { | ||
Authorization: `Bearer ${user?.jwt}`, | ||
} | ||
}, | ||
}, | ||
hooks: { | ||
onPostCreated: ({ id }) => { | ||
router.replace( | ||
{ | ||
pathname: router.pathname, | ||
query: { slug: id }, | ||
as: `/p/${id}`, | ||
}, | ||
undefined, | ||
{ shallow: true } | ||
); | ||
}, | ||
}, | ||
router: { | ||
push: router.push | ||
}, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.