chore: format frontend files with prettier
This commit is contained in:
parent
48163db5d3
commit
bca67c74e2
@ -6,7 +6,7 @@ import { allLocales } from "../__generated__/locale-codes";
|
|||||||
import { getLocale, setLocaleFromUrl } from "../utils/localization";
|
import { getLocale, setLocaleFromUrl } from "../utils/localization";
|
||||||
import { localized } from "@lit/localize";
|
import { localized } from "@lit/localize";
|
||||||
|
|
||||||
type LocaleCode = typeof allLocales[number];
|
type LocaleCode = (typeof allLocales)[number];
|
||||||
type LocaleNames = {
|
type LocaleNames = {
|
||||||
[L in LocaleCode]: string;
|
[L in LocaleCode]: string;
|
||||||
};
|
};
|
||||||
|
@ -148,13 +148,9 @@ export class AcceptInvite extends LiteElement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await this.apiFetch(
|
await this.apiFetch(`/orgs/invite-accept/${this.token}`, this.authState, {
|
||||||
`/orgs/invite-accept/${this.token}`,
|
method: "POST",
|
||||||
this.authState,
|
});
|
||||||
{
|
|
||||||
method: "POST",
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
this.notify({
|
this.notify({
|
||||||
message: msg(str`You've joined ${this.inviteInfo.orgName}.`),
|
message: msg(str`You've joined ${this.inviteInfo.orgName}.`),
|
||||||
@ -174,9 +170,7 @@ export class AcceptInvite extends LiteElement {
|
|||||||
|
|
||||||
private onDecline() {
|
private onDecline() {
|
||||||
this.notify({
|
this.notify({
|
||||||
message: msg(
|
message: msg(str`You've declined to join ${this.inviteInfo.orgName}.`),
|
||||||
str`You've declined to join ${this.inviteInfo.orgName}.`
|
|
||||||
),
|
|
||||||
variant: "info",
|
variant: "info",
|
||||||
icon: "info-circle",
|
icon: "info-circle",
|
||||||
});
|
});
|
||||||
|
@ -210,23 +210,20 @@ export class CrawlsList extends LiteElement {
|
|||||||
</div>
|
</div>
|
||||||
</header>
|
</header>
|
||||||
<section>
|
<section>
|
||||||
${
|
${this.crawls.length
|
||||||
this.crawls.length
|
? this.renderCrawlList()
|
||||||
? this.renderCrawlList()
|
: html`
|
||||||
: html`
|
|
||||||
<div class="border-t border-b py-5">
|
<div class="border-t border-b py-5">
|
||||||
<p class="text-center text-neutral-500">
|
<p class="text-center text-neutral-500">
|
||||||
${msg("No crawls yet.")}
|
${msg("No crawls yet.")}
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
`
|
`}
|
||||||
}
|
|
||||||
</section>
|
</section>
|
||||||
<footer class="m-2">
|
<footer class="m-2">
|
||||||
<span class="text-0-400 text-xs">
|
<span class="text-0-400 text-xs">
|
||||||
${
|
${this.lastFetched
|
||||||
this.lastFetched
|
? msg(html`Last updated:
|
||||||
? msg(html`Last updated:
|
|
||||||
<sl-format-date
|
<sl-format-date
|
||||||
date="${new Date(this.lastFetched).toString()}"
|
date="${new Date(this.lastFetched).toString()}"
|
||||||
month="2-digit"
|
month="2-digit"
|
||||||
@ -236,8 +233,7 @@ export class CrawlsList extends LiteElement {
|
|||||||
minute="numeric"
|
minute="numeric"
|
||||||
second="numeric"
|
second="numeric"
|
||||||
></sl-format-date>`)
|
></sl-format-date>`)
|
||||||
: ""
|
: ""}
|
||||||
}
|
|
||||||
</span>
|
</span>
|
||||||
</footer>
|
</footer>
|
||||||
</main>
|
</main>
|
||||||
@ -330,9 +326,8 @@ export class CrawlsList extends LiteElement {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
${
|
${this.userId
|
||||||
this.userId
|
? html` <div class="h-6 mt-2 flex justify-end">
|
||||||
? html` <div class="h-6 mt-2 flex justify-end">
|
|
||||||
<label>
|
<label>
|
||||||
<span class="text-neutral-500 text-xs mr-1"
|
<span class="text-neutral-500 text-xs mr-1"
|
||||||
>${msg("Show Only Mine")}</span
|
>${msg("Show Only Mine")}</span
|
||||||
@ -344,8 +339,7 @@ export class CrawlsList extends LiteElement {
|
|||||||
></sl-switch>
|
></sl-switch>
|
||||||
</label>
|
</label>
|
||||||
</div>`
|
</div>`
|
||||||
: ""
|
: ""}
|
||||||
}
|
|
||||||
`;
|
`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -62,7 +62,7 @@ const STEPS = [
|
|||||||
"crawlMetadata",
|
"crawlMetadata",
|
||||||
"confirmSettings",
|
"confirmSettings",
|
||||||
] as const;
|
] as const;
|
||||||
type StepName = typeof STEPS[number];
|
type StepName = (typeof STEPS)[number];
|
||||||
type TabState = {
|
type TabState = {
|
||||||
completed: boolean;
|
completed: boolean;
|
||||||
error: boolean;
|
error: boolean;
|
||||||
@ -643,21 +643,19 @@ export class CrawlConfigEditor extends LiteElement {
|
|||||||
private renderFooter({ isFirst = false, isLast = false }) {
|
private renderFooter({ isFirst = false, isLast = false }) {
|
||||||
return html`
|
return html`
|
||||||
<div class="px-6 py-4 border-t flex justify-between">
|
<div class="px-6 py-4 border-t flex justify-between">
|
||||||
${
|
${isFirst
|
||||||
isFirst
|
? html`
|
||||||
? html`
|
|
||||||
<sl-button size="small" type="reset">
|
<sl-button size="small" type="reset">
|
||||||
<sl-icon slot="prefix" name="chevron-left"></sl-icon>
|
<sl-icon slot="prefix" name="chevron-left"></sl-icon>
|
||||||
${this.configId ? msg("Cancel") : msg("Start Over")}
|
${this.configId ? msg("Cancel") : msg("Start Over")}
|
||||||
</sl-button>
|
</sl-button>
|
||||||
`
|
`
|
||||||
: html`
|
: html`
|
||||||
<sl-button size="small" @click=${this.backStep}>
|
<sl-button size="small" @click=${this.backStep}>
|
||||||
<sl-icon slot="prefix" name="chevron-left"></sl-icon>
|
<sl-icon slot="prefix" name="chevron-left"></sl-icon>
|
||||||
${msg("Previous Step")}
|
${msg("Previous Step")}
|
||||||
</sl-button>
|
</sl-button>
|
||||||
`
|
`}
|
||||||
}
|
|
||||||
${when(
|
${when(
|
||||||
this.configId,
|
this.configId,
|
||||||
() => html`
|
() => html`
|
||||||
@ -692,14 +690,12 @@ export class CrawlConfigEditor extends LiteElement {
|
|||||||
?disabled=${this.isSubmitting || this.formHasError}
|
?disabled=${this.isSubmitting || this.formHasError}
|
||||||
?loading=${this.isSubmitting}
|
?loading=${this.isSubmitting}
|
||||||
>
|
>
|
||||||
${
|
${this.formState.scheduleType === "now" ||
|
||||||
this.formState.scheduleType === "now" ||
|
this.formState.runNow
|
||||||
this.formState.runNow
|
? msg("Save & Run Crawl")
|
||||||
? msg("Save & Run Crawl")
|
: this.formState.scheduleType === "none"
|
||||||
: this.formState.scheduleType === "none"
|
? msg("Save Workflow")
|
||||||
? msg("Save Workflow")
|
: msg("Save & Schedule Crawl")}
|
||||||
: msg("Save & Schedule Crawl")
|
|
||||||
}
|
|
||||||
</sl-button>`
|
</sl-button>`
|
||||||
: html`
|
: html`
|
||||||
<div>
|
<div>
|
||||||
@ -1058,11 +1054,9 @@ https://example.net`}
|
|||||||
<btrix-details ?open=${exclusions.length > 0}>
|
<btrix-details ?open=${exclusions.length > 0}>
|
||||||
<span slot="title"
|
<span slot="title"
|
||||||
>${msg("Exclusions")}
|
>${msg("Exclusions")}
|
||||||
${
|
${exclusions.length
|
||||||
exclusions.length
|
? html`<btrix-badge>${exclusions.length}</btrix-badge>`
|
||||||
? html`<btrix-badge>${exclusions.length}</btrix-badge>`
|
: ""}</span
|
||||||
: ""
|
|
||||||
}</span
|
|
||||||
>
|
>
|
||||||
<div class="grid grid-cols-5 gap-4 py-2">
|
<div class="grid grid-cols-5 gap-4 py-2">
|
||||||
${this.renderFormCol(html`
|
${this.renderFormCol(html`
|
||||||
@ -1099,11 +1093,9 @@ https://example.net`}
|
|||||||
<btrix-details>
|
<btrix-details>
|
||||||
<span slot="title">
|
<span slot="title">
|
||||||
${msg("Additional URLs")}
|
${msg("Additional URLs")}
|
||||||
${
|
${additionalUrlList.length
|
||||||
additionalUrlList.length
|
? html`<btrix-badge>${additionalUrlList.length}</btrix-badge>`
|
||||||
? html`<btrix-badge>${additionalUrlList.length}</btrix-badge>`
|
: ""}
|
||||||
: ""
|
|
||||||
}
|
|
||||||
</span>
|
</span>
|
||||||
<div class="grid grid-cols-5 gap-4 py-2">
|
<div class="grid grid-cols-5 gap-4 py-2">
|
||||||
${this.renderFormCol(html`
|
${this.renderFormCol(html`
|
||||||
@ -1184,11 +1176,9 @@ https://archiveweb.page/images/${"logo.svg"}`}
|
|||||||
>
|
>
|
||||||
<span slot="suffix">${msg("pages")}</span>
|
<span slot="suffix">${msg("pages")}</span>
|
||||||
<div slot="help-text">
|
<div slot="help-text">
|
||||||
${
|
${minPages === 1
|
||||||
minPages === 1
|
? msg(str`Minimum ${minPages} page`)
|
||||||
? msg(str`Minimum ${minPages} page`)
|
: msg(str`Minimum ${minPages} pages`)}
|
||||||
: msg(str`Minimum ${minPages} pages`)
|
|
||||||
}
|
|
||||||
</div>
|
</div>
|
||||||
</sl-input>
|
</sl-input>
|
||||||
</sl-mutation-observer>
|
</sl-mutation-observer>
|
||||||
@ -1429,11 +1419,9 @@ https://archiveweb.page/images/${"logo.svg"}`}
|
|||||||
${msg(
|
${msg(
|
||||||
html`Schedule:
|
html`Schedule:
|
||||||
<span class="text-blue-500"
|
<span class="text-blue-500"
|
||||||
>${
|
>${utcSchedule
|
||||||
utcSchedule
|
? humanizeSchedule(utcSchedule)
|
||||||
? humanizeSchedule(utcSchedule)
|
: msg("Invalid date")}</span
|
||||||
: msg("Invalid date")
|
|
||||||
}</span
|
|
||||||
>.`
|
>.`
|
||||||
)}
|
)}
|
||||||
</p>
|
</p>
|
||||||
@ -1441,11 +1429,9 @@ https://archiveweb.page/images/${"logo.svg"}`}
|
|||||||
${msg(
|
${msg(
|
||||||
html`Next scheduled run:
|
html`Next scheduled run:
|
||||||
<span
|
<span
|
||||||
>${
|
>${utcSchedule
|
||||||
utcSchedule
|
? humanizeNextDate(utcSchedule)
|
||||||
? humanizeNextDate(utcSchedule)
|
: msg("Invalid date")}</span
|
||||||
: msg("Invalid date")
|
|
||||||
}</span
|
|
||||||
>.`
|
>.`
|
||||||
)}
|
)}
|
||||||
</p>
|
</p>
|
||||||
@ -1883,12 +1869,10 @@ https://archiveweb.page/images/${"logo.svg"}`}
|
|||||||
|
|
||||||
const renderDetail = ({ loc, msg: detailMsg }: any) => html`
|
const renderDetail = ({ loc, msg: detailMsg }: any) => html`
|
||||||
<li>
|
<li>
|
||||||
${
|
${loc.some((v: string) => v === "seeds") &&
|
||||||
loc.some((v: string) => v === "seeds") &&
|
typeof loc[loc.length - 1] === "number"
|
||||||
typeof loc[loc.length - 1] === "number"
|
? msg(str`Seed URL ${loc[loc.length - 1] + 1}: `)
|
||||||
? msg(str`Seed URL ${loc[loc.length - 1] + 1}: `)
|
: `${loc[loc.length - 1]}: `}
|
||||||
: `${loc[loc.length - 1]}: `
|
|
||||||
}
|
|
||||||
${detailMsg}
|
${detailMsg}
|
||||||
</li>
|
</li>
|
||||||
`;
|
`;
|
||||||
|
@ -13,7 +13,7 @@ export type OrgData = {
|
|||||||
name: string;
|
name: string;
|
||||||
users?: {
|
users?: {
|
||||||
[id: string]: {
|
[id: string]: {
|
||||||
role: typeof AccessCode[UserRole];
|
role: (typeof AccessCode)[UserRole];
|
||||||
name: string;
|
name: string;
|
||||||
email: string;
|
email: string;
|
||||||
};
|
};
|
||||||
|
@ -2,7 +2,7 @@ import type { AccessCode, UserRole, OrgData } from "./org";
|
|||||||
|
|
||||||
export type UserOrg = OrgData & {
|
export type UserOrg = OrgData & {
|
||||||
default?: boolean;
|
default?: boolean;
|
||||||
role: typeof AccessCode[UserRole];
|
role: (typeof AccessCode)[UserRole];
|
||||||
};
|
};
|
||||||
|
|
||||||
export type CurrentUser = {
|
export type CurrentUser = {
|
||||||
|
@ -1,19 +1,19 @@
|
|||||||
import { AccessCode, UserRole } from "../types/org";
|
import { AccessCode, UserRole } from "../types/org";
|
||||||
export * from "../types/org";
|
export * from "../types/org";
|
||||||
|
|
||||||
export function isOwner(accessCode?: typeof AccessCode[UserRole]): boolean {
|
export function isOwner(accessCode?: (typeof AccessCode)[UserRole]): boolean {
|
||||||
if (!accessCode) return false;
|
if (!accessCode) return false;
|
||||||
|
|
||||||
return accessCode === AccessCode.owner;
|
return accessCode === AccessCode.owner;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function isAdmin(accessCode?: typeof AccessCode[UserRole]): boolean {
|
export function isAdmin(accessCode?: (typeof AccessCode)[UserRole]): boolean {
|
||||||
if (!accessCode) return false;
|
if (!accessCode) return false;
|
||||||
|
|
||||||
return accessCode >= AccessCode.owner;
|
return accessCode >= AccessCode.owner;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function isCrawler(accessCode?: typeof AccessCode[UserRole]): boolean {
|
export function isCrawler(accessCode?: (typeof AccessCode)[UserRole]): boolean {
|
||||||
if (!accessCode) return false;
|
if (!accessCode) return false;
|
||||||
|
|
||||||
return accessCode >= AccessCode.crawler;
|
return accessCode >= AccessCode.crawler;
|
||||||
|
Loading…
Reference in New Issue
Block a user