You've already forked nginx-proxy-manager
mirror of
https://github.com/NginxProxyManager/nginx-proxy-manager.git
synced 2025-11-15 22:41:05 +03:00
React
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
import type { Certificate } from "src/api/backend";
|
||||
import { intl } from "src/locale";
|
||||
|
||||
interface Props {
|
||||
certificate?: Certificate;
|
||||
}
|
||||
export function CertificateFormatter({ certificate }: Props) {
|
||||
if (certificate) {
|
||||
return intl.formatMessage({ id: "lets-encrypt" });
|
||||
}
|
||||
|
||||
return intl.formatMessage({ id: "http-only" });
|
||||
}
|
||||
25
frontend/src/components/Table/Formatter/DomainsFormatter.tsx
Normal file
25
frontend/src/components/Table/Formatter/DomainsFormatter.tsx
Normal file
@@ -0,0 +1,25 @@
|
||||
import { intlFormat, parseISO } from "date-fns";
|
||||
import { intl } from "src/locale";
|
||||
|
||||
interface Props {
|
||||
domains: string[];
|
||||
createdOn?: string;
|
||||
}
|
||||
export function DomainsFormatter({ domains, createdOn }: Props) {
|
||||
return (
|
||||
<div className="flex-fill">
|
||||
<div className="font-weight-medium">
|
||||
{domains.map((domain: string) => (
|
||||
<span key={domain} className="badge badge-lg domain-name">
|
||||
{domain}
|
||||
</span>
|
||||
))}
|
||||
</div>
|
||||
{createdOn ? (
|
||||
<div className="text-secondary mt-1">
|
||||
{intl.formatMessage({ id: "created-on" }, { date: intlFormat(parseISO(createdOn)) })}
|
||||
</div>
|
||||
) : null}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
interface Props {
|
||||
url: string;
|
||||
name?: string;
|
||||
}
|
||||
export function GravatarFormatter({ url, name }: Props) {
|
||||
return (
|
||||
<div className="d-flex py-1 align-items-center">
|
||||
<span
|
||||
title={name}
|
||||
className="avatar avatar-2 me-2"
|
||||
style={{
|
||||
backgroundImage: `url(${url})`,
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
11
frontend/src/components/Table/Formatter/StatusFormatter.tsx
Normal file
11
frontend/src/components/Table/Formatter/StatusFormatter.tsx
Normal file
@@ -0,0 +1,11 @@
|
||||
import { intl } from "src/locale";
|
||||
|
||||
interface Props {
|
||||
enabled: boolean;
|
||||
}
|
||||
export function StatusFormatter({ enabled }: Props) {
|
||||
if (enabled) {
|
||||
return <span className="badge bg-lime-lt">{intl.formatMessage({ id: "online" })}</span>;
|
||||
}
|
||||
return <span className="badge bg-red-lt">{intl.formatMessage({ id: "offline" })}</span>;
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
import { intlFormat, parseISO } from "date-fns";
|
||||
import { intl } from "src/locale";
|
||||
|
||||
interface Props {
|
||||
value: string;
|
||||
createdOn?: string;
|
||||
}
|
||||
export function ValueWithDateFormatter({ value, createdOn }: Props) {
|
||||
return (
|
||||
<div className="flex-fill">
|
||||
<div className="font-weight-medium">
|
||||
<div className="font-weight-medium">{value}</div>
|
||||
</div>
|
||||
{createdOn ? (
|
||||
<div className="text-secondary mt-1">
|
||||
{intl.formatMessage({ id: "created-on" }, { date: intlFormat(parseISO(createdOn)) })}
|
||||
</div>
|
||||
) : null}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
5
frontend/src/components/Table/Formatter/index.ts
Normal file
5
frontend/src/components/Table/Formatter/index.ts
Normal file
@@ -0,0 +1,5 @@
|
||||
export * from "./CertificateFormatter";
|
||||
export * from "./DomainsFormatter";
|
||||
export * from "./GravatarFormatter";
|
||||
export * from "./StatusFormatter";
|
||||
export * from "./ValueWithDateFormatter";
|
||||
Reference in New Issue
Block a user