various changes

This commit is contained in:
Andreas 2024-06-23 02:50:54 +02:00
parent 4da9a4f7be
commit cdfbadb805
7 changed files with 38 additions and 16 deletions

6
.gitignore vendored
View File

@ -34,3 +34,9 @@ yarn-error.log*
*.tsbuildinfo
next-env.d.ts
db.sqlite
bucket/85a36ce6-1d2a-4f3c-bbbb-2c6c336bf61e/FB_IMG_1716665756868.jpg
bucket/85a36ce6-1d2a-4f3c-bbbb-2c6c336bf61e/patchnotes.png
bucket/e2ffa828-0b1c-44ec-aaf7-b003f2ff57cb/FB_IMG_1716665756868.jpg
bucket/e2ffa828-0b1c-44ec-aaf7-b003f2ff57cb/patchnotes.png
.env
yarn.lock

View File

@ -44,6 +44,8 @@
"react-bootstrap": "^2.7.4",
"react-dom": "18.2.0",
"react-hot-toast": "^2.4.1",
"remark": "^15.0.1",
"remark-mdx-to-plain-text": "^3.0.0",
"sqlite": "^4.2.1",
"swagger-jsdoc": "^6.2.8",
"swagger-ui-react": "^5.17.2",

View File

@ -61,7 +61,7 @@ export default function PostEditor(props:EditorProps){
<h2 className="m-2">Project</h2>
<select onChange={projectSelectionChange} name="projects" id="projects" defaultValue={props.post?.project?.id} placeholder={props.post?.project?.name} value={projectID} className="m-2">
<option value={0}>unassigned</option>
{props.projects?.map(p=><option value={p.id}>{p.readableIdentifier}</option>)}
{props.projects?.map(p=><option key={`projectSelectionOpt-${p.id}`} value={p.id}>{p.readableIdentifier}</option>)}
</select>
<h2>Attachments</h2>
<table className="table table-striped">
@ -74,18 +74,23 @@ export default function PostEditor(props:EditorProps){
let bucketMap:Map<UUID,PostEditorBucket> = new Map(props.post.buckets.map((b)=>[b.id as UUID,b]));
let bucketList = [...props.post.buckets.map((b)=>b.id)];
return bucketList.map((e)=>{
return <tr><Accordion><AccordionItem eventKey={bucketList.indexOf(e).toString()}><AccordionHeader>{e}</AccordionHeader><AccordionBody><ul>{bucketMap.get(e as UUID)?.attachments.map((attachment)=><li>{attachment.filename}</li>)}</ul></AccordionBody></AccordionItem></Accordion></tr>
return <>
<tr key={`bucketAccordionRow-${bucketList.indexOf(e).toString()}`}><Accordion>
<AccordionItem eventKey={bucketList.indexOf(e).toString()}>
<AccordionHeader>{e}</AccordionHeader>
<AccordionBody>
<ul>
<li><button className='btn btn-success'>Upload new attachment</button></li>
{ bucketMap.get(e as UUID)?.attachments.map((attachment)=><li key={`listItem-file-${attachment.filename}`}>{attachment.filename}</li>) }
</ul>
</AccordionBody>
</AccordionItem>
</Accordion></tr></>
})
})()
}
<tr>
<td colSpan={4}>
<table className="table mb-0">
...
</table>
</td>
</tr>
...
</tbody>
</table>
<button type="button" className="m-2 btn btn-primary">Preview</button>

View File

@ -22,4 +22,14 @@
.summary{
/* flex-shrink: 1; */
padding:8px;
}
}
.article-content p:has(img){
width: 100%;
background-color: var(--background-900);
}
.article-content p img{
margin:auto;
height: 100%;
}

View File

@ -15,7 +15,6 @@ export async function ExampleComponent(){
export default async function Article(params: { id: string|undefined, title: string|undefined, content: string|undefined, date?:string|undefined } ) {
const components = { ExampleComponent }
return (
@ -26,7 +25,7 @@ export default async function Article(params: { id: string|undefined, title: str
<div id="tagbar" className="p-5 self-start"><Tagbar/></div>
</div>
<div className=".article-content p-5 whitespace-pre">
<div className={`${styles['article-content']} p-5 whitespace-pre`}>
<MDXRemote source={params.content?params.content:""} components={components}/>
</div>
<section className=".article-date">{params.date}</section> <br/>

View File

@ -20,7 +20,7 @@ const sequelize = new Sequelize({
});
const dbSync = (async ()=> await sequelize.sync({alter:true}))().then(()=>{
const dbSync = (async ()=> await sequelize.sync())().then(()=>{
addUserScopes();
addUserPermsScopes();
});

View File

@ -52,12 +52,12 @@ export class Post extends Model<InferAttributes<Post>, InferCreationAttributes<P
declare postTags?:NonAttribute<Tag[]>;
@BelongsToMany(()=>Bucket,{through: {model:'PostBucket'}, throughAssociations: {
@BelongsToMany(()=>Bucket,{through: {model:'PostBucket'}, foreignKeyConstraints: false, throughAssociations: {
fromSource: 'postBucketBuckets',
toSource: 'post',
fromTarget: 'postBucketPosts',
toTarget: 'PostBucket',
}, inverse:{as: 'posts'}, foreignKey: 'postId', otherKey: 'bucketId'})
}, inverse:{as: 'posts'}, foreignKey: {name: 'postId', unique: false}, otherKey: 'bucketId', })
declare buckets?:NonAttribute<Bucket[]>;