various changes
This commit is contained in:
		
							parent
							
								
									4da9a4f7be
								
							
						
					
					
						commit
						cdfbadb805
					
				
							
								
								
									
										6
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										6
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							| @ -34,3 +34,9 @@ yarn-error.log* | |||||||
| *.tsbuildinfo | *.tsbuildinfo | ||||||
| next-env.d.ts | next-env.d.ts | ||||||
| db.sqlite | 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 | ||||||
|  | |||||||
| @ -44,6 +44,8 @@ | |||||||
|     "react-bootstrap": "^2.7.4", |     "react-bootstrap": "^2.7.4", | ||||||
|     "react-dom": "18.2.0", |     "react-dom": "18.2.0", | ||||||
|     "react-hot-toast": "^2.4.1", |     "react-hot-toast": "^2.4.1", | ||||||
|  |     "remark": "^15.0.1", | ||||||
|  |     "remark-mdx-to-plain-text": "^3.0.0", | ||||||
|     "sqlite": "^4.2.1", |     "sqlite": "^4.2.1", | ||||||
|     "swagger-jsdoc": "^6.2.8", |     "swagger-jsdoc": "^6.2.8", | ||||||
|     "swagger-ui-react": "^5.17.2", |     "swagger-ui-react": "^5.17.2", | ||||||
|  | |||||||
| @ -61,7 +61,7 @@ export default function PostEditor(props:EditorProps){ | |||||||
|         <h2 className="m-2">Project</h2> |         <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"> |         <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> |             <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> |         </select> | ||||||
|         <h2>Attachments</h2> |         <h2>Attachments</h2> | ||||||
|         <table className="table table-striped"> |         <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 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)]; |                     let bucketList = [...props.post.buckets.map((b)=>b.id)]; | ||||||
|                     return bucketList.map((e)=>{ |                     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> |         </tbody> | ||||||
|         </table> |         </table> | ||||||
|         <button type="button" className="m-2 btn btn-primary">Preview</button> |         <button type="button" className="m-2 btn btn-primary">Preview</button> | ||||||
|  | |||||||
| @ -23,3 +23,13 @@ | |||||||
|     /* flex-shrink: 1; */ |     /* flex-shrink: 1; */ | ||||||
|     padding:8px; |     padding:8px; | ||||||
| } | } | ||||||
|  | 
 | ||||||
|  | .article-content p:has(img){ | ||||||
|  |     width: 100%; | ||||||
|  |     background-color: var(--background-900); | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | .article-content p img{ | ||||||
|  |     margin:auto; | ||||||
|  |     height: 100%; | ||||||
|  | } | ||||||
|  | |||||||
| @ -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 } ) { | export default async function Article(params: { id: string|undefined, title: string|undefined, content: string|undefined, date?:string|undefined } ) { | ||||||
|      |      | ||||||
|      |  | ||||||
|     const components = { ExampleComponent } |     const components = { ExampleComponent } | ||||||
|      |      | ||||||
|     return ( |     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 id="tagbar" className="p-5 self-start"><Tagbar/></div> | ||||||
|              |              | ||||||
|             </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}/> |             <MDXRemote source={params.content?params.content:""} components={components}/> | ||||||
|             </div> |             </div> | ||||||
|             <section className=".article-date">{params.date}</section> <br/> |             <section className=".article-date">{params.date}</section> <br/> | ||||||
|  | |||||||
| @ -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(); |     addUserScopes(); | ||||||
|     addUserPermsScopes(); |     addUserPermsScopes(); | ||||||
| }); | }); | ||||||
|  | |||||||
| @ -52,12 +52,12 @@ export class Post extends Model<InferAttributes<Post>, InferCreationAttributes<P | |||||||
|     declare postTags?:NonAttribute<Tag[]>; |     declare postTags?:NonAttribute<Tag[]>; | ||||||
| 
 | 
 | ||||||
|      |      | ||||||
|     @BelongsToMany(()=>Bucket,{through: {model:'PostBucket'}, throughAssociations: { |     @BelongsToMany(()=>Bucket,{through: {model:'PostBucket'}, foreignKeyConstraints: false, throughAssociations: { | ||||||
|         fromSource: 'postBucketBuckets', |         fromSource: 'postBucketBuckets', | ||||||
|         toSource: 'post', |         toSource: 'post', | ||||||
|         fromTarget: 'postBucketPosts', |         fromTarget: 'postBucketPosts', | ||||||
|         toTarget: 'PostBucket', |         toTarget: 'PostBucket', | ||||||
|     }, inverse:{as: 'posts'}, foreignKey: 'postId', otherKey: 'bucketId'}) |     }, inverse:{as: 'posts'}, foreignKey: {name: 'postId', unique: false}, otherKey: 'bucketId', }) | ||||||
|     declare buckets?:NonAttribute<Bucket[]>; |     declare buckets?:NonAttribute<Bucket[]>; | ||||||
| 
 | 
 | ||||||
|      |      | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user