forked from administration/panel
feat: make some values configurable
parent
efafed4931
commit
2c3ee300c5
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
import { Button } from "@/components/ui/button";
|
import { Button } from "@/components/ui/button";
|
||||||
import { Input } from "@/components/ui/input";
|
import { Input } from "@/components/ui/input";
|
||||||
|
import { API_URL } from "@/lib/constants";
|
||||||
import { useRouter } from "next/navigation";
|
import { useRouter } from "next/navigation";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
|
|
||||||
|
@ -45,7 +46,7 @@ export default function Inspect() {
|
||||||
className="flex-1"
|
className="flex-1"
|
||||||
variant="outline"
|
variant="outline"
|
||||||
onClick={() =>
|
onClick={() =>
|
||||||
fetch("https://api.revolt.chat/invites/" + id)
|
fetch(API_URL + "/invites/" + id)
|
||||||
.then((res) => res.json())
|
.then((res) => res.json())
|
||||||
.then((invite) =>
|
.then((invite) =>
|
||||||
router.push(`/panel/inspect/server/${invite.server_id}`)
|
router.push(`/panel/inspect/server/${invite.server_id}`)
|
||||||
|
|
|
@ -2,6 +2,7 @@ import { Channel } from "revolt-api";
|
||||||
import { Card, CardDescription, CardHeader, CardTitle } from "../ui/card";
|
import { Card, CardDescription, CardHeader, CardTitle } from "../ui/card";
|
||||||
import { Avatar, AvatarFallback, AvatarImage } from "../ui/avatar";
|
import { Avatar, AvatarFallback, AvatarImage } from "../ui/avatar";
|
||||||
import Link from "next/link";
|
import Link from "next/link";
|
||||||
|
import { AUTUMN_URL } from "@/lib/constants";
|
||||||
|
|
||||||
export function ChannelCard({
|
export function ChannelCard({
|
||||||
channel,
|
channel,
|
||||||
|
@ -23,7 +24,7 @@ export function ChannelCard({
|
||||||
<Avatar>
|
<Avatar>
|
||||||
{channel.channel_type !== "DirectMessage" && (
|
{channel.channel_type !== "DirectMessage" && (
|
||||||
<AvatarImage
|
<AvatarImage
|
||||||
src={`https://autumn.revolt.chat/icons/${channel.icon?._id}`}
|
src={`${AUTUMN_URL}/icons/${channel.icon?._id}`}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
<AvatarFallback>
|
<AvatarFallback>
|
||||||
|
|
|
@ -19,6 +19,7 @@ import { decodeTime } from "ulid";
|
||||||
|
|
||||||
import calendarPlugin from "dayjs/plugin/calendar";
|
import calendarPlugin from "dayjs/plugin/calendar";
|
||||||
import Link from "next/link";
|
import Link from "next/link";
|
||||||
|
import { AUTUMN_URL } from "@/lib/constants";
|
||||||
dayjs.extend(calendarPlugin);
|
dayjs.extend(calendarPlugin);
|
||||||
|
|
||||||
export function CompactMessage({
|
export function CompactMessage({
|
||||||
|
@ -56,7 +57,7 @@ export function CompactMessage({
|
||||||
{user?.avatar && (
|
{user?.avatar && (
|
||||||
<Avatar className="w-4 h-4 inline-block align-middle mr-1">
|
<Avatar className="w-4 h-4 inline-block align-middle mr-1">
|
||||||
<AvatarImage
|
<AvatarImage
|
||||||
src={`https://autumn.revolt.chat/avatars/${user.avatar._id}`}
|
src={`${AUTUMN_URL}/avatars/${user.avatar._id}`}
|
||||||
/>
|
/>
|
||||||
</Avatar>
|
</Avatar>
|
||||||
)}
|
)}
|
||||||
|
@ -80,7 +81,7 @@ export function CompactMessage({
|
||||||
{user?.avatar && (
|
{user?.avatar && (
|
||||||
<Avatar className="inline-block align-middle mr-1">
|
<Avatar className="inline-block align-middle mr-1">
|
||||||
<AvatarImage
|
<AvatarImage
|
||||||
src={`https://autumn.revolt.chat/avatars/${user.avatar._id}`}
|
src={`${AUTUMN_URL}/avatars/${user.avatar._id}`}
|
||||||
/>
|
/>
|
||||||
</Avatar>
|
</Avatar>
|
||||||
)}{" "}
|
)}{" "}
|
||||||
|
@ -94,11 +95,11 @@ export function CompactMessage({
|
||||||
target="_blank"
|
target="_blank"
|
||||||
className="w-fit"
|
className="w-fit"
|
||||||
key={attachment._id}
|
key={attachment._id}
|
||||||
href={`https://autumn.revolt.chat/attachments/${attachment._id}`}
|
href={`${AUTUMN_URL}/attachments/${attachment._id}`}
|
||||||
>
|
>
|
||||||
<img
|
<img
|
||||||
className="max-h-[240px] object-contain"
|
className="max-h-[240px] object-contain"
|
||||||
src={`https://autumn.revolt.chat/attachments/${attachment._id}`}
|
src={`${AUTUMN_URL}/attachments/${attachment._id}`}
|
||||||
/>
|
/>
|
||||||
</a>
|
</a>
|
||||||
) : (
|
) : (
|
||||||
|
|
|
@ -2,6 +2,7 @@ import { Server } from "revolt-api";
|
||||||
import { Card, CardDescription, CardHeader, CardTitle } from "../ui/card";
|
import { Card, CardDescription, CardHeader, CardTitle } from "../ui/card";
|
||||||
import { Avatar, AvatarFallback, AvatarImage } from "../ui/avatar";
|
import { Avatar, AvatarFallback, AvatarImage } from "../ui/avatar";
|
||||||
import Link from "next/link";
|
import Link from "next/link";
|
||||||
|
import { AUTUMN_URL } from "@/lib/constants";
|
||||||
|
|
||||||
export function ServerCard({
|
export function ServerCard({
|
||||||
server,
|
server,
|
||||||
|
@ -16,7 +17,7 @@ export function ServerCard({
|
||||||
<CardTitle>
|
<CardTitle>
|
||||||
<Avatar>
|
<Avatar>
|
||||||
<AvatarImage
|
<AvatarImage
|
||||||
src={`https://autumn.revolt.chat/icons/${server.icon?._id}`}
|
src={`${AUTUMN_URL}/icons/${server.icon?._id}`}
|
||||||
/>
|
/>
|
||||||
<AvatarFallback>
|
<AvatarFallback>
|
||||||
{server.name
|
{server.name
|
||||||
|
|
|
@ -2,6 +2,7 @@ import { User } from "revolt-api";
|
||||||
import { Card, CardDescription, CardHeader, CardTitle } from "../ui/card";
|
import { Card, CardDescription, CardHeader, CardTitle } from "../ui/card";
|
||||||
import { Avatar, AvatarFallback, AvatarImage } from "../ui/avatar";
|
import { Avatar, AvatarFallback, AvatarImage } from "../ui/avatar";
|
||||||
import { Badge } from "../ui/badge";
|
import { Badge } from "../ui/badge";
|
||||||
|
import { AUTUMN_URL } from "@/lib/constants";
|
||||||
|
|
||||||
export function UserCard({ user, subtitle }: { user: User; subtitle: string }) {
|
export function UserCard({ user, subtitle }: { user: User; subtitle: string }) {
|
||||||
return (
|
return (
|
||||||
|
@ -9,7 +10,7 @@ export function UserCard({ user, subtitle }: { user: User; subtitle: string }) {
|
||||||
className="shadow-none bg-no-repeat bg-right text-left"
|
className="shadow-none bg-no-repeat bg-right text-left"
|
||||||
style={{
|
style={{
|
||||||
backgroundImage: user.profile?.background
|
backgroundImage: user.profile?.background
|
||||||
? `linear-gradient(to right, white, rgba(255,0,0,0)), url('https://autumn.revolt.chat/backgrounds/${user.profile.background._id}')`
|
? `linear-gradient(to right, white, rgba(255,0,0,0)), url('${AUTUMN_URL}/backgrounds/${user.profile.background._id}')`
|
||||||
: "",
|
: "",
|
||||||
backgroundSize: "75%",
|
backgroundSize: "75%",
|
||||||
}}
|
}}
|
||||||
|
@ -18,7 +19,7 @@ export function UserCard({ user, subtitle }: { user: User; subtitle: string }) {
|
||||||
<CardTitle className="overflow-hidden overflow-ellipsis whitespace-nowrap">
|
<CardTitle className="overflow-hidden overflow-ellipsis whitespace-nowrap">
|
||||||
<Avatar>
|
<Avatar>
|
||||||
<AvatarImage
|
<AvatarImage
|
||||||
src={`https://autumn.revolt.chat/avatars/${user.avatar?._id}`}
|
src={`${AUTUMN_URL}/avatars/${user.avatar?._id}`}
|
||||||
/>
|
/>
|
||||||
<AvatarFallback className="overflow-hidden overflow-ellipsis whitespace-nowrap">
|
<AvatarFallback className="overflow-hidden overflow-ellipsis whitespace-nowrap">
|
||||||
{(user.display_name ?? user.username)
|
{(user.display_name ?? user.username)
|
||||||
|
|
|
@ -1 +1,3 @@
|
||||||
export const PLATFORM_MOD_ID = "01FC17E1WTM2BGE4F3ARN3FDAF";
|
export const PLATFORM_MOD_ID = process.env.PLATFORM_MOD_ID || "01FC17E1WTM2BGE4F3ARN3FDAF";
|
||||||
|
export const AUTUMN_URL = process.env.AUTUMN_URL || "https://autumn.revolt.chat";
|
||||||
|
export const API_URL = process.env.API_URL || "https://api.revolt.chat";
|
||||||
|
|
Loading…
Reference in New Issue