WHAT IF NOTHING IS SET????
This commit is contained in:
		
							parent
							
								
									5bd12cbe9f
								
							
						
					
					
						commit
						37bbaf262e
					
				
					 5 changed files with 22 additions and 19 deletions
				
			
		|  | @ -5,13 +5,13 @@ import pb from "../lib/pb"; | ||||||
| 
 | 
 | ||||||
| const avatarRec = await pb | const avatarRec = await pb | ||||||
|   .collection("images") |   .collection("images") | ||||||
|   .getFirstListItem("useAsAvatar=true"); |   .getFirstListItem("useAsAvatar=true").catch(() => null); | ||||||
| 
 | 
 | ||||||
| const icon = await pb.files.getUrl(avatarRec, avatarRec.file); | const icon = avatarRec ? await pb.files.getUrl(avatarRec, avatarRec.file, { thumb: avatarRec.thumb }) : null; | ||||||
| const socials = await pb.collection("socials").getFullList(); | const socials = await pb.collection("socials").getFullList(); | ||||||
| 
 | 
 | ||||||
| const config = { | const config = { | ||||||
|   icon, |   // icon, | ||||||
|   socials, |   socials, | ||||||
|   title: import.meta.env.PUBLIC_TITLE, |   title: import.meta.env.PUBLIC_TITLE, | ||||||
|   description: import.meta.env.PUBLIC_DESCRIPTION, |   description: import.meta.env.PUBLIC_DESCRIPTION, | ||||||
|  | @ -70,10 +70,11 @@ const config = { | ||||||
|   <style> |   <style> | ||||||
|     img.icon { |     img.icon { | ||||||
|       width: 10rem; |       width: 10rem; | ||||||
|  |       height: 10rem; | ||||||
|       margin: 0 auto; |       margin: 0 auto; | ||||||
|       object-fit: cover; |       object-fit: cover; | ||||||
|       object-position: center; |       object-position: center; | ||||||
|       border-radius: 100%; |       border-radius: 50%; | ||||||
|     } |     } | ||||||
|   </style> |   </style> | ||||||
| </aside> | </aside> | ||||||
|  |  | ||||||
|  | @ -5,9 +5,8 @@ import pb from "../lib/pb"; | ||||||
| 
 | 
 | ||||||
| const avatarRec = await pb | const avatarRec = await pb | ||||||
|   .collection("images") |   .collection("images") | ||||||
|   .getFirstListItem("useAsAvatar=true"); |   .getFirstListItem("useAsAvatar=true").catch(() => null); | ||||||
| 
 | const icon = avatarRec ? await pb.files.getUrl(avatarRec, avatarRec.file) : null; | ||||||
| const icon = await pb.files.getUrl(avatarRec, avatarRec.file); |  | ||||||
| const socials = await pb.collection("socials").getFullList(); | const socials = await pb.collection("socials").getFullList(); | ||||||
| 
 | 
 | ||||||
| const config = { | const config = { | ||||||
|  | @ -21,7 +20,7 @@ const config = { | ||||||
| <aside> | <aside> | ||||||
|   <div class="p-4"> |   <div class="p-4"> | ||||||
|     <a href="/"> |     <a href="/"> | ||||||
|       { |       <!-- { | ||||||
|         config.icon && ( |         config.icon && ( | ||||||
|           <Image |           <Image | ||||||
|             class={"icon"} |             class={"icon"} | ||||||
|  | @ -31,7 +30,7 @@ const config = { | ||||||
|             height={50} |             height={50} | ||||||
|           /> |           /> | ||||||
|         ) |         ) | ||||||
|       } |       } --> | ||||||
|       <h1 class="font-bold text-2xl pt-4">{config.title}</h1></a |       <h1 class="font-bold text-2xl pt-4">{config.title}</h1></a | ||||||
|     > |     > | ||||||
|     <p class="pt-4">{config.description}</p> |     <p class="pt-4">{config.description}</p> | ||||||
|  |  | ||||||
|  | @ -5,13 +5,15 @@ import pb from "../lib/pb"; | ||||||
| 
 | 
 | ||||||
| const avatarRec = await pb | const avatarRec = await pb | ||||||
|   .collection("images") |   .collection("images") | ||||||
|   .getFirstListItem("useAsAvatar=true"); |   .getFirstListItem("useAsAvatar=true").catch(() => null); | ||||||
| const backgroundRec = await pb | const backgroundRec = await pb | ||||||
|   .collection("images") |   .collection("images") | ||||||
|   .getFirstListItem("useAsBackground=true"); |   .getFirstListItem("useAsBackground=true").catch(() => null); | ||||||
| 
 | 
 | ||||||
| const icon = await pb.files.getUrl(avatarRec, avatarRec.file); | console.log(avatarRec); | ||||||
| const background = await pb.files.getUrl(backgroundRec, backgroundRec.file); | 
 | ||||||
|  | const icon = avatarRec ? await pb.files.getUrl(avatarRec, avatarRec.file) : null; | ||||||
|  | const background = backgroundRec ? await pb.files.getUrl(backgroundRec, backgroundRec.file) : null; | ||||||
| const socials = await pb.collection("socials").getFullList(); | const socials = await pb.collection("socials").getFullList(); | ||||||
| 
 | 
 | ||||||
| const config = { | const config = { | ||||||
|  |  | ||||||
|  | @ -7,13 +7,13 @@ export const prerender = false; | ||||||
| 
 | 
 | ||||||
| const avatarRec = await pb | const avatarRec = await pb | ||||||
|   .collection("images") |   .collection("images") | ||||||
|   .getFirstListItem("useAsAvatar=true"); |   .getFirstListItem("useAsAvatar=true").catch(() => null); | ||||||
| const backgroundRec = await pb | const backgroundRec = await pb | ||||||
|   .collection("images") |   .collection("images") | ||||||
|   .getFirstListItem("useAsBackground=true"); |   .getFirstListItem("useAsBackground=true").catch(() => null); | ||||||
| 
 | 
 | ||||||
| const icon = await pb.files.getUrl(avatarRec, avatarRec.file); | const icon = avatarRec ? await pb.files.getUrl(avatarRec, avatarRec.file) : null; | ||||||
| const background = await pb.files.getUrl(backgroundRec, backgroundRec.file); | const background = backgroundRec ? await pb.files.getUrl(backgroundRec, backgroundRec.file) : null; | ||||||
| const socials = await pb.collection("socials").getFullList(); | const socials = await pb.collection("socials").getFullList(); | ||||||
| 
 | 
 | ||||||
| const config = { | const config = { | ||||||
|  |  | ||||||
|  | @ -1,8 +1,9 @@ | ||||||
| --- | --- | ||||||
| import pb from "../lib/pb"; | import pb from "../lib/pb"; | ||||||
| export const prerender = false | export const prerender = false | ||||||
| const backgroundRec = await pb.collection('images').getFirstListItem('useAsBackground=true'); | const backgroundRec = await pb.collection('images').getFirstListItem('useAsBackground=true').catch(() => null); | ||||||
| const background = await pb.files.getUrl(backgroundRec, backgroundRec.file); | const background = backgroundRec ? await pb.files.getUrl(backgroundRec, backgroundRec.file) : null; | ||||||
|  | 
 | ||||||
| --- | --- | ||||||
| 
 | 
 | ||||||
| <!doctype html> | <!doctype html> | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		
		Reference in a new issue