Skip to content

Commit

Permalink
Merge pull request #33 from Kinfe123/feat/spotter
Browse files Browse the repository at this point in the history
feat: Date based sorting
  • Loading branch information
Kinfe123 authored Jun 4, 2024
2 parents 0da36b9 + bdab309 commit 962ae79
Show file tree
Hide file tree
Showing 10 changed files with 20 additions and 11 deletions.
6 changes: 6 additions & 0 deletions apps/www/@/lib/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,9 @@ export function formatDate(input: string | number): string {
year: "numeric",
})
}


export const dateConvert = (input: string) => {
const date = new Date(input)
return date.getTime()
}
7 changes: 5 additions & 2 deletions apps/www/app/templates/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { allTemplates } from "contentlayer/generated";
import HeroAnimated from "components/HeroAnimated";
import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs";
import { Separator } from "@/components/ui/separator";
import { cn } from "@/lib/utils";
import { cn, dateConvert } from "@/lib/utils";
import BgGradient from "components/ui/BgGradient";

type MetaInfo = {
Expand Down Expand Up @@ -41,7 +41,10 @@ export const metadata = {
};

const Template = async () => {
const templates = allTemplates;
const templates = allTemplates.sort(
(a, b) => dateConvert(b.date) - dateConvert(a.date)
);

const free_templates = templates.filter((temp) => temp.is_free);
const paid_templates = templates.filter((temp) => !temp.is_free);
const total_purchased = 4; // to be later moved to an endpoint
Expand Down
2 changes: 1 addition & 1 deletion apps/www/content/templates/afri-farm.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ images:
- templates/afri-farm/afri-farm-06.png
- templates/afri-farm/afri-farm-07.png

date: 2022-02-22
date: 2024-03-22
live_preview: https://afri-farm.vercel.app
source_code: https://github.com/Kinfe123/AFRI-FARM
stack_used:
Expand Down
3 changes: 1 addition & 2 deletions apps/www/content/templates/chacha.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ images:
- templates/chacha/chacha-4.png
- templates/chacha/chacha-5.png


date: 2022-02-22
date: 2024-05-25
live_preview: https://chachas.vercel.app
source_code: https://github.com/Kinfe123/chacha
stack_used:
Expand Down
2 changes: 1 addition & 1 deletion apps/www/content/templates/dumper.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ images:
- templates/dumper/dumper-2.png
- templates/dumper/dumper-3.png
- templates/dumper/dumper-4.png
date: 2022-02-22
date: 2023-11-22
live_preview: https://kinfish-dumpy.vercel.app
source_code: https://github.com/Kinfe123/kinfish-dumpy
stack_used:
Expand Down
2 changes: 1 addition & 1 deletion apps/www/content/templates/mdify.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ images:
- templates/mdify/mdify-5.png
- templates/mdify/mdify-6.png
- templates/mdify/mdify-7.png
date: 2022-02-22
date: 2024-05-24
live_preview: https://md-jsonify.vercel.app
source_code: https://github.com/Kinfe123/md-jsonify
stack_used:
Expand Down
2 changes: 1 addition & 1 deletion apps/www/content/templates/megamess.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ images:
- templates/megamess/megamess-3.png
- templates/megamess/megamess-4.png
- templates/megamess/megamess-5.png
date: 2022-02-22
date: 2024-05-22
live_preview: https://mega-mess.vercel.app
stack_used:
- nextjs
Expand Down
2 changes: 1 addition & 1 deletion apps/www/content/templates/shadow.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ images:
- templates/shadow.png
- templates/shadow.png
- templates/shadow.png
date: 2022-02-22
date: date: 2024-05-28
live_preview: https://shadow-02.vercel.app
source_code: https://github.com/Kinfe123/shad0w-2
stack_used:
Expand Down
2 changes: 1 addition & 1 deletion apps/www/content/templates/spotter.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ images:
- templates/spotter/spotter-4.png
- templates/spotter/spotter-5.png
- templates/spotter/spotter-6.png
date: 2022-02-22
date: 2024-06-01
live_preview: https://spotter-one.vercel.app
stack_used:
- nextjs
Expand Down
3 changes: 2 additions & 1 deletion apps/www/content/templates/steel.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ description: The perfect solution for showcasing your product, desktop app, or m
is_free: true
images:
- templates/steel.png
date: 2022-02-22
date: 2024-01-22

live_preview: https://shad0w-2.vercel.app
source_code: https://github.com/Kinfe123/shadow_cast
stack_used:
Expand Down

0 comments on commit 962ae79

Please sign in to comment.