feat: admin user
This commit is contained in:
parent
b12ebb7ec2
commit
950a461fb1
5 changed files with 23 additions and 8 deletions
|
|
@ -2,12 +2,13 @@ DATABASE_URL="postgresql://frieren:frieren@localhost:5432/tomodachi-share?schema
|
|||
REDIS_URL="redis://localhost:6379/0"
|
||||
|
||||
BASE_URL=https://tomodachi-share.trafficlunar.net
|
||||
|
||||
NEXTAUTH_URL=https://tomodachi-share.trafficlunar.net # This should be the same as BASE_URL
|
||||
AUTH_SECRET=XXXXXXXXXXXXXXXX
|
||||
AUTH_TRUST_HOST=true
|
||||
|
||||
AUTH_TRUST_HOST=true
|
||||
AUTH_SECRET=XXXXXXXXXXXXXXXX
|
||||
AUTH_DISCORD_ID=XXXXXXXXXXXXXXXX
|
||||
AUTH_DISCORD_SECRET=XXXXXXXXXXXXXXXX
|
||||
AUTH_GITHUB_ID=XXXXXXXXXXXXXXXX
|
||||
AUTH_GITHUB_SECRET=XXXXXXXXXXXXXXXX
|
||||
|
||||
NEXT_PUBLIC_ADMIN_USER_ID=1
|
||||
|
|
@ -65,7 +65,7 @@ body {
|
|||
}
|
||||
|
||||
[data-tooltip]::after {
|
||||
@apply content-[attr(data-tooltip)] absolute left-1/2 -translate-x-1/2 top-full mt-2 px-2 py-1 bg-orange-400 border border-orange-400 rounded text-sm text-white opacity-0 scale-75 transition-all duration-200 ease-out origin-top shadow-md whitespace-nowrap select-none pointer-events-none;
|
||||
@apply content-[attr(data-tooltip)] absolute left-1/2 -translate-x-1/2 top-full mt-2 px-2 py-1 bg-orange-400 border border-orange-400 rounded-md text-sm text-white opacity-0 scale-75 transition-all duration-200 ease-out origin-top shadow-md whitespace-nowrap select-none pointer-events-none;
|
||||
}
|
||||
|
||||
[data-tooltip]:hover::before,
|
||||
|
|
|
|||
|
|
@ -167,7 +167,7 @@ export default async function MiiPage({ params }: Props) {
|
|||
</ul>
|
||||
</section>
|
||||
<div className="flex gap-1 text-4xl justify-end text-orange-400">
|
||||
{Number(session?.user.id) === mii.userId && (
|
||||
{session && (Number(session.user.id) === mii.userId || Number(session.user.id) === Number(process.env.NEXT_PUBLIC_ADMIN_USER_ID)) && (
|
||||
<>
|
||||
<Link href={`/edit/${mii.id}`} title="Edit Mii" data-tooltip="Edit" className="aspect-square">
|
||||
<Icon icon="mdi:pencil" />
|
||||
|
|
|
|||
|
|
@ -92,7 +92,14 @@ export default async function ProfilePage({ params }: Props) {
|
|||
/>
|
||||
|
||||
<div className="flex flex-col w-full relative">
|
||||
<h1 className="text-4xl font-extrabold w-full break-words">{user?.name}</h1>
|
||||
<h1 className="text-4xl font-extrabold w-full break-words flex items-center gap-2">
|
||||
{user?.name}
|
||||
{user.id === Number(process.env.NEXT_PUBLIC_ADMIN_USER_ID) && (
|
||||
<div data-tooltip="Admin" className="font-normal text-orange-400">
|
||||
<Icon icon="mdi:shield-moon" />
|
||||
</div>
|
||||
)}
|
||||
</h1>
|
||||
<h2 className="text-lg font-semibold break-words">@{user?.username}</h2>
|
||||
|
||||
<h4 className="mt-auto text-sm">
|
||||
|
|
|
|||
|
|
@ -39,7 +39,14 @@ export default async function ProfileSettingsPage() {
|
|||
/>
|
||||
|
||||
<div className="flex flex-col w-full relative">
|
||||
<h1 className="text-4xl font-extrabold w-full break-words">{session.user.name}</h1>
|
||||
<h1 className="text-4xl font-extrabold w-full break-words flex items-center gap-2">
|
||||
{session.user.name}
|
||||
{Number(session.user.id) === Number(process.env.NEXT_PUBLIC_ADMIN_USER_ID) && (
|
||||
<div data-tooltip="Admin" className="font-normal text-orange-400">
|
||||
<Icon icon="mdi:shield-moon" />
|
||||
</div>
|
||||
)}
|
||||
</h1>
|
||||
<h2 className="text-lg font-semibold break-words">@{session.user.username}</h2>
|
||||
|
||||
<h4 className="mt-auto">
|
||||
|
|
|
|||
Loading…
Reference in a new issue