Commit 0cd60c90 by Arjun Jhukal

updated the meta data for the game

parent 5d57629f
...@@ -69,109 +69,109 @@ jobs: ...@@ -69,109 +69,109 @@ jobs:
# pm2 start ecosystem.config.js --env production # pm2 start ecosystem.config.js --env production
# EOF # EOF
- name: Notify Slack on Success # - name: Notify Slack on Success
if: success() # if: success()
uses: slackapi/slack-github-action@v1.27.0 # uses: slackapi/slack-github-action@v1.27.0
with: # with:
payload: | # payload: |
{ # {
"text": "✅ getFirekirin Deployment Successful!", # "text": "✅ getFirekirin Deployment Successful!",
"blocks": [ # "blocks": [
{ # {
"type": "header", # "type": "header",
"text": { # "text": {
"type": "plain_text", # "type": "plain_text",
"text": "✅ getFirekirin Deployment Successful" # "text": "✅ getFirekirin Deployment Successful"
} # }
}, # },
{ # {
"type": "section", # "type": "section",
"fields": [ # "fields": [
{ # {
"type": "mrkdwn", # "type": "mrkdwn",
"text": "*Repository:*\n${{ github.repository }}" # "text": "*Repository:*\n${{ github.repository }}"
}, # },
{ # {
"type": "mrkdwn", # "type": "mrkdwn",
"text": "*Branch:*\n${{ github.ref_name }}" # "text": "*Branch:*\n${{ github.ref_name }}"
}, # },
{ # {
"type": "mrkdwn", # "type": "mrkdwn",
"text": "*Commit:*\n<${{ github.event.head_commit.url }}|${{ github.sha }}>" # "text": "*Commit:*\n<${{ github.event.head_commit.url }}|${{ github.sha }}>"
}, # },
{ # {
"type": "mrkdwn", # "type": "mrkdwn",
"text": "*Author:*\n${{ github.actor }}" # "text": "*Author:*\n${{ github.actor }}"
} # }
] # ]
}, # },
{ # {
"type": "section", # "type": "section",
"text": { # "text": {
"type": "mrkdwn", # "type": "mrkdwn",
"text": "*Message:* ${{ github.event.head_commit.message }}" # "text": "*Message:* ${{ github.event.head_commit.message }}"
} # }
}, # },
{ # {
"type": "context", # "type": "context",
"elements": [ # "elements": [
{ # {
"type": "mrkdwn", # "type": "mrkdwn",
"text": "Deployed to production at <!date^${{ github.event.head_commit.timestamp }}^{date_num} {time_secs}|${{ github.event.head_commit.timestamp }}>" # "text": "Deployed to production at <!date^${{ github.event.head_commit.timestamp }}^{date_num} {time_secs}|${{ github.event.head_commit.timestamp }}>"
} # }
] # ]
} # }
] # ]
} # }
env: # env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} # SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK # SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK
- name: Notify Slack on Failure # - name: Notify Slack on Failure
if: failure() # if: failure()
uses: slackapi/slack-github-action@v1.27.0 # uses: slackapi/slack-github-action@v1.27.0
with: # with:
payload: | # payload: |
{ # {
"text": "❌ getFirekirin Deployment Failed!", # "text": "❌ getFirekirin Deployment Failed!",
"blocks": [ # "blocks": [
{ # {
"type": "header", # "type": "header",
"text": { # "text": {
"type": "plain_text", # "type": "plain_text",
"text": "❌ getFirekirin Deployment Failed" # "text": "❌ getFirekirin Deployment Failed"
} # }
}, # },
{ # {
"type": "section", # "type": "section",
"fields": [ # "fields": [
{ # {
"type": "mrkdwn", # "type": "mrkdwn",
"text": "*Repository:*\n${{ github.repository }}" # "text": "*Repository:*\n${{ github.repository }}"
}, # },
{ # {
"type": "mrkdwn", # "type": "mrkdwn",
"text": "*Branch:*\n${{ github.ref_name }}" # "text": "*Branch:*\n${{ github.ref_name }}"
}, # },
{ # {
"type": "mrkdwn", # "type": "mrkdwn",
"text": "*Commit:*\n<${{ github.event.head_commit.url }}|${{ github.sha }}>" # "text": "*Commit:*\n<${{ github.event.head_commit.url }}|${{ github.sha }}>"
}, # },
{ # {
"type": "mrkdwn", # "type": "mrkdwn",
"text": "*Author:*\n${{ github.actor }}" # "text": "*Author:*\n${{ github.actor }}"
} # }
] # ]
}, # },
{ # {
"type": "section", # "type": "section",
"text": { # "text": {
"type": "mrkdwn", # "type": "mrkdwn",
"text": "*Action:*\n<${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|View Workflow Run>" # "text": "*Action:*\n<${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|View Workflow Run>"
} # }
} # }
] # ]
} # }
env: # env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} # SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK # SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK
...@@ -7,8 +7,21 @@ const SITE_URL = process.env.NEXT_PUBLIC_FRONTEND_URL!; ...@@ -7,8 +7,21 @@ const SITE_URL = process.env.NEXT_PUBLIC_FRONTEND_URL!;
export async function generateMetadata(props: { params: Promise<{ id: string }> }): Promise<Metadata> { export async function generateMetadata(props: { params: Promise<{ id: string }> }): Promise<Metadata> {
const { id } = await props.params; const { id } = await props.params;
const canonicalUrl = `${SITE_URL}/exclusive-games/${id}`.replace(/\/$/, ""); const canonicalUrl = `${SITE_URL}/exclusive-games/${id}`.replace(/\/$/, "");
const game = await getSingleGame(id);
return { return {
title: game?.data?.meta?.meta_title || game?.data?.name,
description: game?.data?.meta?.meta_description || game?.data?.name,
openGraph: {
title: game?.data?.meta?.meta_title || game?.data?.name,
description: game?.data?.meta?.meta_description || game?.data?.name,
images: game?.data?.meta?.og_image_url
},
twitter: {
title: game?.data?.meta?.meta_title || game?.data?.name,
description: game?.data?.meta?.meta_description || game?.data?.name,
images: game?.data?.meta?.og_image_url
},
alternates: { alternates: {
canonical: canonicalUrl, canonical: canonicalUrl,
}, },
......
...@@ -49,15 +49,16 @@ export default function ActionGroup({ ...@@ -49,15 +49,16 @@ export default function ActionGroup({
{({ TransitionProps }) => ( {({ TransitionProps }) => (
<Fade {...TransitionProps} timeout={300}> <Fade {...TransitionProps} timeout={300}>
<Paper <Paper
elevation={3}
sx={{ sx={{
width: 215, width: 215,
borderRadius: 2, borderRadius: 2,
mt: 1, mt: 1,
p: 0,
overflow: "hidden"
}} }}
> >
<ClickAwayListener onClickAway={handleClose}> <ClickAwayListener onClickAway={handleClose}>
<List> <List className='p-0!'>
{onView ? <ListItem> {onView ? <ListItem>
<Link href={onView || ""} className='block py-3 px-4 hover:bg-[#FBF4FB]'>View Profile</Link> <Link href={onView || ""} className='block py-3 px-4 hover:bg-[#FBF4FB]'>View Profile</Link>
</ListItem> : ""} </ListItem> : ""}
......
import { GameProps } from "@/types/game";
import { InputLabel, OutlinedInput } from "@mui/material";
import { FormikProps } from "formik";
import InputFile from "../atom/InputFile";
export default function MetaDescription({
formik,
}: {
formik: FormikProps<GameProps>;
}) {
return (
<div className="form__field__wrapper border border-gray rounded-[16px] mb-6">
<div className="form__title py-6 px-10 border-b border-gray">
<h2 className="text-[20px] leading-[140%] font-bold">
SEO Setting
</h2>
</div>
<div className="form__fields p-6 lg:p-10 flex flex-col gap-4 lg:gap-6">
{/* Meta Title */}
<div className="input__field">
<InputLabel htmlFor="meta.meta_title">Meta Title</InputLabel>
<OutlinedInput
fullWidth
id="meta.meta_title"
name="meta.meta_title"
placeholder="Enter the Meta Title"
value={formik.values.meta?.meta_title || ""}
onChange={formik.handleChange}
onBlur={formik.handleBlur}
/>
</div>
{/* Meta Description */}
<div className="input__field">
<InputLabel htmlFor="meta.meta_description">
Meta Description
</InputLabel>
<OutlinedInput
fullWidth
id="meta.meta_description"
name="meta.meta_description"
placeholder="Enter the SEO Description"
value={formik.values.meta?.meta_description || ""}
onChange={formik.handleChange}
onBlur={formik.handleBlur}
multiline
minRows={3}
/>
</div>
{/* Meta Image */}
<div className="input__field">
<InputFile
name="meta.og_image"
label="Thumbnail of the Game"
value={formik.values.meta?.og_image || null}
onChange={(file: File | File[] | null) =>
formik.setFieldValue("meta.og_image", file)
}
onBlur={() =>
formik.setFieldTouched("meta.og_image", true)
}
serverFile={formik.values.meta?.og_image_url}
onRemoveServerFile={() =>
formik.setFieldValue("meta.og_image_url", undefined)
}
/>
</div>
</div>
</div>
);
}
...@@ -160,7 +160,7 @@ export default function AdminMenu({ open }: { open: boolean }) { ...@@ -160,7 +160,7 @@ export default function AdminMenu({ open }: { open: boolean }) {
> >
<Link <Link
href={href} href={href}
className={`flex gap-2 items-start px-4 py-2 ${open ? "expanded" : "collapsed" className={`flex gap-2 items-center px-4 py-2 ${open ? "expanded" : "collapsed"
} ${active ? "active__menu" : ""}`} } ${active ? "active__menu" : ""}`}
> >
<ListItemIcon className={open ? "expanded" : "collapsed"}> <ListItemIcon className={open ? "expanded" : "collapsed"}>
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
import InputFile from "@/components/atom/InputFile"; import InputFile from "@/components/atom/InputFile";
import SelectField from "@/components/atom/SelectField"; import SelectField from "@/components/atom/SelectField";
import ReactQuillEditor from "@/components/molecules/ReactQuill"; import ReactQuillEditor from "@/components/molecules/ReactQuill";
import MetaDescription from "@/components/organism/Meta";
import { useAppDispatch } from "@/hooks/hook"; import { useAppDispatch } from "@/hooks/hook";
import { PATH } from "@/routes/PATH"; import { PATH } from "@/routes/PATH";
import { useAddGameMutation, useGetGameByIdQuery, useUpdateGameByIdMutation } from "@/services/gameApi"; import { useAddGameMutation, useGetGameByIdQuery, useUpdateGameByIdMutation } from "@/services/gameApi";
...@@ -76,6 +77,20 @@ export default function AddGameForm({ id }: AddGameFormProps) { ...@@ -76,6 +77,20 @@ export default function AddGameForm({ id }: AddGameFormProps) {
formData.append("description", values.description); formData.append("description", values.description);
formData.append("api", values.api); formData.append("api", values.api);
formData.append("provider", values.provider); formData.append("provider", values.provider);
if (values.meta) {
if (values.meta.meta_title) {
formData.append("meta[meta_title]", values.meta.meta_title);
}
if (values.meta.meta_description) {
formData.append("meta[meta_description]", values.meta.meta_description);
}
if (values.meta.og_image) {
formData.append("meta[og_image]", values.meta.og_image);
}
if (values.meta.og_image_url) {
formData.append("meta[og_image_url]", values.meta.og_image_url);
}
}
if (values.profit) formData.append("profit", values.profit); if (values.profit) formData.append("profit", values.profit);
if (values.thumbnail instanceof File) { if (values.thumbnail instanceof File) {
...@@ -153,14 +168,13 @@ export default function AddGameForm({ id }: AddGameFormProps) { ...@@ -153,14 +168,13 @@ export default function AddGameForm({ id }: AddGameFormProps) {
} }
}; };
return ( return (
<form onSubmit={formik.handleSubmit}> <form onSubmit={formik.handleSubmit}>
<MetaDescription formik={formik} />
<div className="form__field__wrapper border-solid border-[1px] border-gray rounded-[16px] mb-6"> <div className="form__field__wrapper border-solid border-[1px] border-gray rounded-[16px] mb-6">
<div className="form__title py-6 px-10 border-b-solid border-b-[1px] border-gray"> <div className="form__title py-6 px-10 border-b-solid border-b-[1px] border-gray">
<h2 className="text-[20px] leading-[140%] font-bold">Overview of the Game</h2> <h2 className="text-[20px] leading-[140%] font-bold">Overview of the Game</h2>
</div> </div>
<div className="form__fields p-6 lg:p-10 flex flex-col gap-4 lg:gap-6 "> <div className="form__fields p-6 lg:p-10 flex flex-col gap-4 lg:gap-6 ">
{/* Name */} {/* Name */}
<div className="input__field"> <div className="input__field">
...@@ -276,6 +290,7 @@ export default function AddGameForm({ id }: AddGameFormProps) { ...@@ -276,6 +290,7 @@ export default function AddGameForm({ id }: AddGameFormProps) {
</div> </div>
</div> </div>
{/* Game Configuration */} {/* Game Configuration */}
<div className="form__field__wrapper border-solid border-[1px] border-gray rounded-[16px]"> <div className="form__field__wrapper border-solid border-[1px] border-gray rounded-[16px]">
<div className="form__title py-6 px-10 border-b-solid border-b-[1px] border-gray"> <div className="form__title py-6 px-10 border-b-solid border-b-[1px] border-gray">
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
import ActionGroup from '@/components/molecules/Action'; import ActionGroup from '@/components/molecules/Action';
import { useAppDispatch } from '@/hooks/hook'; import { useAppDispatch } from '@/hooks/hook';
import { PATH } from '@/routes/PATH';
import { useDeleteGameByIdMutation, useGetAllGamesQuery } from '@/services/gameApi'; import { useDeleteGameByIdMutation, useGetAllGamesQuery } from '@/services/gameApi';
import { showToast, ToastVariant } from '@/slice/toastSlice'; import { showToast, ToastVariant } from '@/slice/toastSlice';
import { GameItem } from '@/types/game'; import { GameItem } from '@/types/game';
...@@ -59,6 +60,7 @@ export default function AdminGameList() { ...@@ -59,6 +60,7 @@ export default function AdminGameList() {
{game.name} {game.name}
</h2> </h2>
<ActionGroup <ActionGroup
onEdit={`${PATH.ADMIN.GAMES.EDIT_GAME.ROOT}/${game?.id}`}
onDelete={async () => { onDelete={async () => {
try { try {
......
export interface MetaProps {
meta_title: string;
meta_description: string;
og_image: File | null;
og_image_url?: string;
}
export interface FileResponse { export interface FileResponse {
file_name: string; file_name: string;
mime_type: string; mime_type: string;
...@@ -7,7 +14,7 @@ export interface FileResponse { ...@@ -7,7 +14,7 @@ export interface FileResponse {
export interface CommonGameProps { export interface CommonGameProps {
name: string; name: string;
category?: string; category?: string;
meta?: MetaProps,
description: string; description: string;
api: string; api: string;
provider: string; provider: string;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment