Commit 44062eb7 by Arjun Jhukal

updated the new user name and password at game detail

parent 9a49c7cc
"use client";
import { useGetUserBalanceBySlugQuery } from '@/services/userApi';
import React from 'react'
import CopyToClipboard from './CopyToClipboard';
import { CardPasswordField } from './CardPasswordHandler';
export default function SingleGameCred({ username, password }: { username: string; password: string }) {
return (
<ul className="mt-4">
<li className="py-2 border-b border-[rgba(255,255,255,0.2)] grid grid-cols-2">
<span className="text-[12px] leading-[120%] font-[600]">Username :</span>
<div className="flex justify-between items-center">
<span className="text-[11px]">
{username}
</span>
{username && (
<CopyToClipboard text={username} />
)}
</div>
</li>
<li className="py-2 border-b border-[rgba(255,255,255,0.2)] grid grid-cols-2">
<span className="text-[12px] leading-[120%] font-[600]">Password :</span>
<CardPasswordField password={password} />
</li>
</ul>
)
}
...@@ -11,10 +11,11 @@ import Link from "next/link"; ...@@ -11,10 +11,11 @@ import Link from "next/link";
import UserCoin from "./UserCoin"; import UserCoin from "./UserCoin";
import { redirect } from "next/dist/server/api-utils"; import { redirect } from "next/dist/server/api-utils";
import GameIframeDialog from "./GameIframeDialog"; import GameIframeDialog from "./GameIframeDialog";
import SingleGameCred from "../../../gameCredentials/SingleGameCred";
export default function ExclusiveGameDetail({ game }: { game: SingleGameResponse }) { export default function ExclusiveGameDetail({ game }: { game: SingleGameResponse }) {
console.log({ isIframe: game?.data?.is_iframe, gameUrl: game?.data?.game_url, redirect: game?.data?.has_redirection });
return ( return (
<> <>
...@@ -60,6 +61,12 @@ export default function ExclusiveGameDetail({ game }: { game: SingleGameResponse ...@@ -60,6 +61,12 @@ export default function ExclusiveGameDetail({ game }: { game: SingleGameResponse
</Box>} </Box>}
</div> </div>
<div className="game_cred">
<h2 className="text-[24px]">Credentials for {game?.data?.name}</h2>
<SingleGameCred username={game?.data?.user?.name || "Arjun"} password={game?.data?.user?.password || "Arjun"} />
</div>
{ {
game?.data?.is_iframe game?.data?.is_iframe
? ( ? (
......
...@@ -6,7 +6,7 @@ import { GlobalResponse, QueryParams } from "@/types/config"; ...@@ -6,7 +6,7 @@ import { GlobalResponse, QueryParams } from "@/types/config";
export const notificationApi = createApi({ export const notificationApi = createApi({
reducerPath: "notificationApi", reducerPath: "notificationApi",
baseQuery: baseQuery, baseQuery: baseQuery,
tagTypes: ['Notification'], tagTypes: ['Notification', "Activity"],
endpoints: (builder) => ({ endpoints: (builder) => ({
getAllNotification: builder.query<NotificationResponse, QueryParams>({ getAllNotification: builder.query<NotificationResponse, QueryParams>({
query: ({ search, page, per_page }) => { query: ({ search, page, per_page }) => {
...@@ -35,8 +35,23 @@ export const notificationApi = createApi({ ...@@ -35,8 +35,23 @@ export const notificationApi = createApi({
method: "POST", method: "POST",
}), }),
invalidatesTags: ["Notification"] invalidatesTags: ["Notification"]
}) }),
getAllActivity: builder.query<NotificationResponse, { activity_type: string } & QueryParams>({
query: ({ search, page, per_page, activity_type }) => {
const params = new URLSearchParams();
if (search) params.append('search', search);
if (page) params.append('page', page.toString());
if (per_page) params.append('page_size', per_page.toString());
if (per_page) params.append('activity_type', activity_type.toString());
const queryString = params.toString();
return {
url: `/api/admin/activity${queryString ? `?${queryString}` : ''}`,
method: "GET"
}
},
providesTags: ["Activity"]
}),
}) })
}) })
export const { useGetAllNotificationQuery, useReadNotificationMutation, useReadAllNotificationMutation } = notificationApi export const { useGetAllNotificationQuery, useReadNotificationMutation, useReadAllNotificationMutation, useGetAllActivityQuery } = notificationApi
\ No newline at end of file \ No newline at end of file
...@@ -30,6 +30,10 @@ export interface GameItem extends CommonGameProps { ...@@ -30,6 +30,10 @@ export interface GameItem extends CommonGameProps {
game_url?: string; game_url?: string;
is_iframe?: boolean; is_iframe?: boolean;
has_redirection?: boolean; has_redirection?: boolean;
user?: {
name: string;
password: string;
}
} }
export interface Pagination { export interface Pagination {
......
...@@ -15,3 +15,12 @@ export interface NotificationResponse { ...@@ -15,3 +15,12 @@ export interface NotificationResponse {
pagination: Pagination pagination: Pagination
} }
} }
export interface ActivityResponse {
success: boolean;
message: string;
data: {
data: {}[];
pagination: Pagination;
}
}
\ No newline at end of file
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