Skip to content

Commit

Permalink
Merge pull request #7 from shaniit-org/dev
Browse files Browse the repository at this point in the history
update on precommit ignore for fly
  • Loading branch information
Riley1101 authored Nov 24, 2023
2 parents 0f30f2f + 01c2fd9 commit 8f9d3b8
Show file tree
Hide file tree
Showing 6 changed files with 106 additions and 102 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./jsconfig.json --watch",
"lint": "prettier --plugin-search-dir . --check . && eslint .",
"format": "prettier --plugin-search-dir . --write .",
"prepare": "husky install"
"dev-prepare": "husky install"
},
"devDependencies": {
"@flydotio/dockerfile": "^0.4.11",
Expand Down
2 changes: 1 addition & 1 deletion src/lib/components/page/home/Highlight.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
</p>
<Button
kind="secondary"
href={`/blogs/${data.slug}`}
href={data.authors ? `/blogs/${data.slug}` : `/events/${data.slug}`}
icon={LinkIcon}
class="cursor-pointer max-w-max"
>Read More
Expand Down
127 changes: 65 additions & 62 deletions src/lib/studio/schema/pages/home/document.js
Original file line number Diff line number Diff line change
@@ -1,66 +1,69 @@
import { FaHome } from 'react-icons/fa';

export default {
id: 'homePage',
icon: FaHome,
title: 'Home Page',
name: 'homePage',
type: 'document',
fields: [
{
title: 'SEO',
name: 'seo',
type: 'seo'
},
{
title: 'Sections',
name: 'sections',
type: 'array',
of: [
{
name: 'Hero',
type: 'homePage.hero'
},
{
title: 'Pinned News',
name: 'Highlight',
type: 'reference',
to: [
{
type: 'news'
}
]
},
{
name: 'News',
type: 'homePage.news'
},
{
name: 'Donate',
title: 'Donate',
type: 'banner'
},
{
name: 'Events',
type: 'homePage.events'
}
]
}
],
preview: {
select: {
title: 'seo.title',
media: 'seo.ogImage'
},
/**
* @param {import('sanity').PreviewProps} props
*/
prepare({ title, media, subtitle }) {
return {
title: title || 'Home Page',
subtitle: subtitle,
media
};
}
}
id: 'homePage',
icon: FaHome,
title: 'Home Page',
name: 'homePage',
type: 'document',
fields: [
{
title: 'SEO',
name: 'seo',
type: 'seo'
},
{
title: 'Sections',
name: 'sections',
type: 'array',
of: [
{
name: 'Hero',
type: 'homePage.hero'
},
{
title: 'Highlight',
name: 'Highlight',
type: 'reference',
to: [
{
type: 'news'
},
{
type: 'event'
}
]
},
{
name: 'News',
type: 'homePage.news'
},
{
name: 'Donate',
title: 'Donate',
type: 'banner'
},
{
name: 'Events',
type: 'homePage.events'
}
]
}
],
preview: {
select: {
title: 'seo.title',
media: 'seo.ogImage'
},
/**
* @param {import('sanity').PreviewProps} props
*/
prepare({ title, media, subtitle }) {
return {
title: title || 'Home Page',
subtitle: subtitle,
media
};
}
}
};
59 changes: 30 additions & 29 deletions src/lib/types/homePage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,52 +2,53 @@ import type { Term } from '.';
import type { News, Event } from '.';

export interface HomePageHero {
_type: 'Hero';
title: string;
heroImage: SanityImage;
_type: 'Hero';
title: string;
heroImage: SanityImage;
}
export interface HighLightNews extends News {
_type: 'Highlight';
title: string;
description: string;
slug: string;
_type: 'Highlight';
title: string;
description: string;
slug: string;
authors: any;
}

export interface HomePageNews {
_type: 'News';
title: string;
description: string;
_type: 'News';
title: string;
description: string;
}

export interface HomePageEvents {
_type: 'Events';
title: string;
description: string;
_type: 'Events';
title: string;
description: string;
}

export interface HomePageDonate {
_type: 'Donate';
title: string;
description: string;
link: Link;
_type: 'Donate';
title: string;
description: string;
link: Link;
}

export interface HomePage {
_type: 'homePage';
term: Term;
seo: BaseMetaData;
sections: HomePageSections[];
_type: 'homePage';
term: Term;
seo: BaseMetaData;
sections: HomePageSections[];
}

type HomePageSections =
| HomePageHero
| HomePageNews
| HomePageEvents
| HomePageDonate
| HighLightNews;
| HomePageHero
| HomePageNews
| HomePageEvents
| HomePageDonate
| HighLightNews;

export interface HomePageData {
homePage: HomePage;
news: News[];
events: Event[];
homePage: HomePage;
news: News[];
events: Event[];
}
17 changes: 9 additions & 8 deletions src/routes/+page.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ const query = `{
"slug":slug.current,
title,
description,
authors,
},
},
},
Expand All @@ -39,12 +40,12 @@ const query = `{
* @type {import('@sveltejs/kit').Load}
*/
export const load = async () => {
/**
* @type {import('$lib/types/homePage').HomePageData}
*/
const data = await getPageData(query);
if (!data.homePage) throw error(404, 'Not Found');
return {
data
};
/**
* @type {import('$lib/types/homePage').HomePageData}
*/
const data = await getPageData(query);
if (!data.homePage) throw error(404, 'Not Found');
return {
data
};
};
1 change: 0 additions & 1 deletion src/routes/blogs/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
*/
export let data;
let { title, news, seo, categories } = data.data;
console.log(categories);
</script>

<Meta data={seo} />
Expand Down

0 comments on commit 8f9d3b8

Please sign in to comment.