-
-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Public org profile page (#2172)
- Enables creating a public org profile page with description and website at `/profile/<org slug>` - Updates current "Overview" page to be "Dashboard", found under `/dashboard` - Organizes org "General" settings tab by "General", "Profile", and "Developer Tools" - Adds sign up banner to log in page for consistent CTA banners - Updates copy and docs to support changes - Allows user to set collection to private, public, or unlisted - Adds route for public collection page with basic page layout - Refactors copy button to abstract clipboard functionality --------- Co-authored-by: Henry Wilkinson <[email protected]> Co-authored-by: emma <[email protected]>
- Loading branch information
1 parent
50d0a36
commit 5e7bc26
Showing
32 changed files
with
1,038 additions
and
198 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
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
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
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
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,50 @@ | ||
import clsx from "clsx"; | ||
import { html } from "lit"; | ||
import { customElement, property } from "lit/decorators.js"; | ||
import { ifDefined } from "lit/directives/if-defined.js"; | ||
|
||
import { BtrixElement } from "@/classes/BtrixElement"; | ||
|
||
@customElement("btrix-link") | ||
export class Link extends BtrixElement { | ||
@property({ type: String }) | ||
href?: HTMLAnchorElement["href"]; | ||
|
||
@property({ type: String }) | ||
target?: HTMLAnchorElement["target"]; | ||
|
||
@property({ type: String }) | ||
rel?: HTMLAnchorElement["rel"]; | ||
|
||
@property({ type: String }) | ||
variant: "primary" | "neutral" = "neutral"; | ||
|
||
render() { | ||
if (!this.href) return; | ||
|
||
return html` | ||
<a | ||
class=${clsx( | ||
"group inline-flex items-center gap-1 transition-colors", | ||
{ | ||
primary: "text-primary-500 hover:text-primary-600", | ||
neutral: "text-blue-500 hover:text-blue-600", | ||
}[this.variant], | ||
)} | ||
href=${this.href} | ||
target=${ifDefined(this.target)} | ||
rel=${ifDefined(this.rel)} | ||
@click=${this.target === "_blank" || this.href.startsWith("http") | ||
? () => {} | ||
: this.navigate.link} | ||
> | ||
<slot></slot> | ||
<sl-icon | ||
slot="suffix" | ||
name="arrow-right" | ||
class="size-4 transition-transform group-hover:translate-x-1" | ||
></sl-icon | ||
></a> | ||
`; | ||
} | ||
} |
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 @@ | ||
// import type { SlInputEvent } from "@shoelace-style/shoelace"; | ||
import { msg } from "@lit/localize"; | ||
import SlInput from "@shoelace-style/shoelace/dist/components/input/input.js"; | ||
import { customElement, property } from "lit/decorators.js"; | ||
|
||
export function validURL(url: string) { | ||
// adapted from: https://gist.github.com/dperini/729294 | ||
return /^(?:https?:\/\/)?(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z0-9\u00a1-\uffff][a-z0-9\u00a1-\uffff_-]{0,62})?[a-z0-9\u00a1-\uffff]\.)+(?:[a-z\u00a1-\uffff]{2,}\.?))(?::\d{2,5})?(?:[/?#]\S*)?$/i.test( | ||
url, | ||
); | ||
} | ||
|
||
/** | ||
* URL input field with validation. | ||
* | ||
* @TODO Use types from SlInput | ||
* | ||
* @attr {String} name | ||
* @attr {String} size | ||
* @attr {String} name | ||
* @attr {String} label | ||
* @attr {String} value | ||
*/ | ||
@customElement("btrix-url-input") | ||
export class Component extends SlInput { | ||
@property({ type: Number, reflect: true }) | ||
minlength = 4; | ||
|
||
@property({ type: String, reflect: true }) | ||
placeholder = "https://example.com"; | ||
|
||
connectedCallback(): void { | ||
this.inputmode = "url"; | ||
|
||
super.connectedCallback(); | ||
|
||
this.addEventListener("sl-input", this.onInput); | ||
this.addEventListener("sl-blur", this.onBlur); | ||
} | ||
|
||
disconnectedCallback(): void { | ||
super.disconnectedCallback(); | ||
|
||
this.removeEventListener("sl-input", this.onInput); | ||
this.removeEventListener("sl-blur", this.onBlur); | ||
} | ||
|
||
private readonly onInput = async () => { | ||
console.log("input 1"); | ||
await this.updateComplete; | ||
|
||
if (!this.checkValidity() && validURL(this.value)) { | ||
this.setCustomValidity(""); | ||
this.helpText = ""; | ||
} | ||
}; | ||
|
||
private readonly onBlur = async () => { | ||
await this.updateComplete; | ||
|
||
const value = this.value; | ||
|
||
if (value && !validURL(value)) { | ||
const text = msg("Please enter a valid URL."); | ||
this.helpText = text; | ||
this.setCustomValidity(text); | ||
} else if ( | ||
value && | ||
!value.startsWith("https://") && | ||
!value.startsWith("http://") | ||
) { | ||
this.value = `https://${value}`; | ||
} | ||
}; | ||
} |
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,26 @@ | ||
import { localized, msg } from "@lit/localize"; | ||
import { html } from "lit"; | ||
import { customElement } from "lit/decorators.js"; | ||
|
||
import { BtrixElement } from "@/classes/BtrixElement"; | ||
|
||
@localized() | ||
@customElement("btrix-verified-badge") | ||
export class Component extends BtrixElement { | ||
render() { | ||
return html` | ||
<sl-tooltip | ||
class="part-[body]:max-w-48 part-[body]:text-xs" | ||
content=${msg( | ||
"This organization has been verified by Webrecorder to be who they say they are.", | ||
)} | ||
> | ||
<btrix-tag | ||
><sl-icon name="check-circle-fill" class="-ml-1 mr-1"></sl-icon>${msg( | ||
"Verified", | ||
)}</btrix-tag | ||
> | ||
</sl-tooltip> | ||
`; | ||
} | ||
} |
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
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
Oops, something went wrong.