forked from live-apps-in/kitty-chan-ui
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f6ee024
commit 7ab1ec8
Showing
77 changed files
with
6,866 additions
and
2,248 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,3 @@ | ||
{ | ||
"plugins": ["@typescript-eslint"], | ||
"extends": [ | ||
"next/core-web-vitals", | ||
"plugin:@typescript-eslint/recommended", | ||
"prettier" | ||
], | ||
"rules": { | ||
"prefer-const": "off" | ||
} | ||
"extends": "next/core-web-vitals" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,7 @@ | |
/node_modules | ||
/.pnp | ||
.pnp.js | ||
.yarn/install-state.gz | ||
|
||
# testing | ||
/coverage | ||
|
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
"use client"; | ||
import { useSearchParams, useRouter } from "next/navigation"; | ||
import { useEffect, useState } from "react"; | ||
import axios from "axios"; | ||
import Cookies from "js-cookie"; | ||
import Loader from "@/components/loader"; | ||
|
||
export default function DiscordAuth() { | ||
const [loading, setLoading] = useState(false); | ||
|
||
const searchParams = useSearchParams(); | ||
const code = searchParams.get("code"); | ||
|
||
const router = useRouter(); | ||
|
||
const authenticateUser = async () => { | ||
try { | ||
setLoading(true); | ||
const { | ||
data: { accessToken }, | ||
status, | ||
} = await axios.get( | ||
`${process.env.NEXT_PUBLIC_KITTY_CHAN_API}/auth/discord?code=${code}` | ||
); | ||
|
||
if (status === 200) { | ||
Cookies.set("accessToken", accessToken, { | ||
expires: 7, | ||
}); | ||
router.push("/servers"); | ||
} | ||
console.log(accessToken); | ||
setLoading(false); | ||
} catch (error) { | ||
console.log(error); | ||
setLoading(false); | ||
} | ||
}; | ||
|
||
useEffect(() => { | ||
authenticateUser(); | ||
}, []); | ||
|
||
return ( | ||
loading && ( | ||
<div className="flex items-center justify-center h-screen"> | ||
<div className="flex flex-col items-center justify-center"> | ||
<Loader /> | ||
<p className="mt-2 font-semibold text-sm"> | ||
Launching kitty! Please wait... | ||
</p> | ||
</div> | ||
</div> | ||
) | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
"use client"; | ||
import axios from "axios"; | ||
import { useParams } from "next/navigation"; | ||
import { useEffect, useState } from "react"; | ||
import Cookies from "js-cookie"; | ||
import { AnalyticsDto } from "@/types/features/analytics"; | ||
import { Skeleton } from "@/components/ui/skeleton"; | ||
|
||
const AnalyticsPage = () => { | ||
const { guildId } = useParams(); | ||
|
||
const [analytics, setAnalytics] = useState<AnalyticsDto>(); | ||
const [loading, setLoading] = useState(false); | ||
|
||
const fetchAnalytics = async () => { | ||
try { | ||
setLoading(true); | ||
const { data } = await axios.get( | ||
`${process.env.NEXT_PUBLIC_KITTY_CHAN_API}/guild/analytics/overview`, | ||
{ | ||
headers: { | ||
Authorization: `Bearer ${Cookies.get("accessToken")}`, | ||
"x-guild-id": guildId, | ||
}, | ||
} | ||
); | ||
setAnalytics(data); | ||
} catch (error) { | ||
console.log(`Error fetching analytics: ${error}`); | ||
} finally { | ||
setLoading(false); | ||
} | ||
}; | ||
|
||
useEffect(() => { | ||
fetchAnalytics(); | ||
}, []); | ||
|
||
console.log(analytics); | ||
|
||
return ( | ||
<> | ||
<p className="heading w-52 mb-6">Overview</p> | ||
<div className="flex items-center gap-4"> | ||
<div className="p-6 w-64 shadow-md bg-[#0e0e0e] rounded-lg"> | ||
<p className="font-semibold capitalize text-2xl bg-gradient-to-r from-purple-300 via-purple-200 to-purple-300 bg-clip-text text-transparent"> | ||
Active members | ||
</p> | ||
{loading ? ( | ||
<Skeleton className="w-[100px] h-[30px] mt-4 rounded-full" /> | ||
) : ( | ||
<p className="text-5xl font-semibold mt-2"> | ||
{analytics?.members.active} | ||
</p> | ||
)} | ||
</div> | ||
|
||
<div className="p-6 w-64 shadow-md bg-[#0e0e0e] rounded-lg "> | ||
<p className="font-semibold capitalize text-2xl bg-gradient-to-r from-purple-300 via-purple-200 to-purple-300 bg-clip-text text-transparent"> | ||
Messages count | ||
</p> | ||
{loading ? ( | ||
<Skeleton className="w-[100px] h-[30px] mt-4 rounded-full" /> | ||
) : ( | ||
<p className="text-5xl font-semibold mt-2"> | ||
{analytics?.messages.count} | ||
</p> | ||
)} | ||
</div> | ||
</div> | ||
</> | ||
); | ||
}; | ||
|
||
export default AnalyticsPage; |
47 changes: 47 additions & 0 deletions
47
app/(features)/dashboard/[guildId]/greet/[target]/embed/[templateId]/page.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
"use client" | ||
import { useParams } from "next/navigation"; | ||
import { useEffect, useState } from "react"; | ||
import Cookies from "js-cookie"; | ||
import axios from "axios"; | ||
import EmbedBuilder from "@/components/template-builders/embed-builder/EmbedBuilder"; | ||
|
||
const EditEmbedTemplatePage = () => { | ||
const { templateId, target, guildId } = useParams(); | ||
const [template, setTemplate] = useState<any>(); | ||
|
||
async function fetchTemplate() { | ||
try { | ||
const { data } = await axios.get( | ||
`${process.env.NEXT_PUBLIC_KITTY_CHAN_API}/template/${templateId}/view`, | ||
{ | ||
headers: { | ||
Authorization: `Bearer ${Cookies.get("accessToken")}`, | ||
"x-guild-id": guildId, | ||
}, | ||
} | ||
); | ||
|
||
setTemplate(data); | ||
} catch (error) { | ||
console.log("Fetch Greet Template Error: ", error); | ||
} | ||
} | ||
|
||
useEffect(() => { | ||
if (templateId) { | ||
fetchTemplate(); | ||
} | ||
}, [templateId]); | ||
|
||
return ( | ||
template && ( | ||
<EmbedBuilder | ||
target={target} | ||
templateToEdit={template} | ||
feature="greet" | ||
currentGuildId={guildId} | ||
/> | ||
) | ||
); | ||
}; | ||
export default EditEmbedTemplatePage; |
13 changes: 13 additions & 0 deletions
13
app/(features)/dashboard/[guildId]/greet/[target]/embed/page.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
"use client"; | ||
import EmbedBuilder from "@/components/template-builders/embed-builder/EmbedBuilder"; | ||
import { useParams } from "next/navigation"; | ||
|
||
const AddEmbedTemplatePage = () => { | ||
const { guildId, target } = useParams(); | ||
|
||
return ( | ||
<EmbedBuilder target={target} currentGuildId={guildId} feature="greet" /> | ||
); | ||
}; | ||
|
||
export default AddEmbedTemplatePage; |
Oops, something went wrong.