Skip to content

Commit

Permalink
seo and general panel
Browse files Browse the repository at this point in the history
  • Loading branch information
GraemeFulton committed Aug 23, 2024
1 parent 98180b6 commit de15b61
Show file tree
Hide file tree
Showing 5 changed files with 117 additions and 63 deletions.
97 changes: 52 additions & 45 deletions lib/editor/menus/settingsMenuNotes.js
Original file line number Diff line number Diff line change
@@ -1,52 +1,59 @@
export const generalMenu =({postObject})=> [
{
type: 'date',
label: 'Publish Date',
initialValue: null,
adminOnly:false,
onValueChange: (value) => {
// Handle the date change
console.log('Date changed:', value);
},
description: 'Set a publish date.',
export const settingsMenu = [
{
type: 'date',
field:'date',
label: 'Publish Date',
initialValue: null,
onValueChange: (value) => {
// Handle the date change
console.log('Date changed:', value);
},
{
type: 'select',
label: 'Status',
initialValue: '',
adminOnly:false,
onValueChange: (value) => {
// Handle the post status change
console.log('Post status changed:', value);
},
options: [
{ label: 'Draft', value: 'draft' },
{ label: 'Pending', value: 'pending' },
{ label: 'Publish', value: 'publish' },
],
description: '(draft, pending, or publish)',
description: 'Set a publish date.',
adminOnly: true,
},
{
type: 'select',
label: 'Status',
field:'status',
initialValue: '',
onValueChange: (value) => {
// Handle the post status change
console.log('Post status changed:', value);
},
{
type: 'url',
label: 'Url',
initialValue: '',
onValueChange: (value) => {
// Handle the value change, e.g., update parent component state
console.log('Slug changed:', value);
},
description: 'Url slug for your post',
options: [
{ label: 'Draft', value: 'draft' },
{ label: 'Pending', value: 'pending' },
{ label: 'Publish', value: 'publish' },
],
description: '(draft, pending, or publish)',
adminOnly: false,
},
{
type: 'url',
field:'slug',
label: 'Url',
initialValue: '',
onValueChange: (value) => {
// Handle the value change, e.g., update parent component state
console.log('Slug changed:', value);
},
{
type: 'number',
label: 'Tier',
initialValue: '',
onValueChange: (value) => {
// Handle the tier change
console.log('Tier changed:', value);
},
description: '(1-5 for quality ranking)',
description: 'Url slug for your post',
adminOnly: false,
},
{
type: 'number',
field:'tier',
label: 'Tier',
initialValue: '',
onValueChange: (value) => {
// Handle the tier change
console.log('Tier changed:', value);
},
];
description: '(1-5 for quality ranking)',
adminOnly: true,
},
];


export const seoMenu = [
{
Expand Down
4 changes: 2 additions & 2 deletions lib/editor/typrNotesProps.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { createPost } from "@/lib/editor/createPost";
import { savePost } from "@/lib/editor/savePost";
import { getUserArticle } from "@/lib/api";
// import { loggedInMenu } from "./menus/loggedInMenu";
import { settingsMenuNotes,seoMenu } from "./menus/settingsMenuNotes";
import { settingsMenu,seoMenu } from "./menus/settingsMenuNotes";

export const typrNotesProps = ({ user, userLoading, mutateUser, router }) => ({
enablePublishingFlow: false,
Expand All @@ -27,7 +27,7 @@ export const typrNotesProps = ({ user, userLoading, mutateUser, router }) => ({
settingsPanel: {
show: true,
generalTab: {
menu: settingsMenuNotes,
menu: settingsMenu,
},
seoTab: {
menu: seoMenu,
Expand Down
47 changes: 47 additions & 0 deletions lib/rss/generateNotesRSS.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import RSS from 'rss';
// import fs from 'fs';
// const path = require('path');

export default async function generateToolsRSS(allPosts) {
const site_url = process.env.NEXT_PUBLIC_HOME_URL;

const feedOptions = {
title: 'Notes on Prototypr | RSS Feed',
description: 'Notes, and ideas on Prototypr!',
site_url: site_url,
feed_url: `${site_url}/rss/notes.xml`,
image_url: `${site_url}/static/images/logo-small.svg`,
pubDate: new Date(),
copyright: `All rights reserved ${new Date().getFullYear()}, Prototypr`,
};

const feed = new RSS(feedOptions);
for(var x =0;x<allPosts?.length;x++){
const post = allPosts[x]
let coverImage = post.attributes.featuredImage?.data?.attributes?.url
? post.attributes.featuredImage?.data?.attributes?.url
: post.attributes.legacyFeaturedImage?.mediaItemUrl
? post.attributes.legacyFeaturedImage.mediaItemUrl
: "https://s3-us-west-1.amazonaws.com/tinify-bucket/%2Fprototypr%2Ftemp%2F1595435549331-1595435549330.png";

feed.item({
title: post?.attributes?.title,
description: post?.attributes?.excerpt,
url: `${site_url}/notes/${post?.attributes?.slug}`,
date: post.date,
enclosure:{
url:coverImage,
'type' : 'image/png'
}
});
}
return feed
// const fullFilePath = path.join(process.cwd(), 'public/rss', 'tools.xml')
// // remove the old file
// if (fs.existsSync(fullFilePath)) {
// await fs.promises.unlink(fullFilePath)
// }

// fs.writeFileSync(fullFilePath, feed.xml({ indent: true }));

}
28 changes: 14 additions & 14 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@
"swiper": "^8.0.0",
"swr": "^1.3.0",
"tailwindcss-border-gradient-radius": "^3.0.1",
"tiptypr": "^0.0.87",
"tiptypr": "^0.0.88",
"tsparticles": "^2.7.1",
"uuidv4": "^6.2.13",
"yup": "^0.32.11",
Expand Down Expand Up @@ -168,7 +168,7 @@
"tailwindcss-scoped-groups": "^2.0.0"
},
"optionalDependencies": {
"@prototypr/paper-interview": "^0.0.472",
"@prototypr/paper-interview": "^0.0.473",
"@prototypr/prototypr-postie": "^1.0.91"
}
}

0 comments on commit de15b61

Please sign in to comment.