render NitroKit::AppShell.new(
id: "gallery-hybrid-application-populated",
layout: :hybrid,
data: {
gallery_shell_preview: "true",
gallery_application: "hybrid",
gallery_application_state: "populated"
}
) do |shell|
shell.brand { strong { "Northstar Admin" } }
shell.navigation do
render_application_navigation(
id: "gallery-hybrid-application-populated-navigation",
current: :settings,
context: "Team plan",
appearance_picker_id: "gallery-hybrid-application-navigation-appearance"
)
end
shell.topbar do
render NitroKit::Dropdown.new(id: "gallery-hybrid-application-account-menu") do |menu|
menu.trigger("Ada Lovelace", variant: :ghost, size: :sm)
menu.item("View public profile", href: "#public-profile")
menu.item("Download account data")
menu.separator
menu.item("Sign out")
end
end
shell.main do
render_application_main do
render NitroKit::PageHeader.new(
title: "Account settings",
description: "Manage the public profile and personal appearance without duplicating application chrome.",
id: "gallery-hybrid-application-populated-header"
)
appearance_picker("gallery-hybrid-application-main-appearance", label: "Content appearance")
render NitroKit::SettingsLayout.new(id: "gallery-hybrid-application-settings") do |layout|
layout.navigation(label: "Account settings") do
render NitroKit::Flex.new(dir: :col, gap: 1, align: :stretch) do
render NitroKit::Button.new(
"Profile",
href: "#profile",
variant: :primary,
aria: { current: "page" }
)
render NitroKit::Button.new("Security", href: "#security")
render NitroKit::Button.new("Notifications", href: "#notifications")
render NitroKit::Button.new("Appearance", href: "#appearance")
end
end
layout.content do
render NitroKit::Flex.new(dir: :col, gap: 6, align: :stretch) do
render NitroKit::ProgressiveImage.new(
attachment: demo_attachment,
alt: "Abstract cover for Ada Lovelace's workspace profile",
size: :sm,
id: "gallery-hybrid-application-profile-image"
)
render NitroKit::DetailsTable.new(
PROFILE,
id: "gallery-hybrid-application-profile-details"
) do |details|
details.field(:name)
details.field(:email)
details.field(:role) do |role|
render NitroKit::Badge.new(role.to_s.humanize, color: :success, size: :sm)
end
details.fields(:website, :joined_on, :last_seen)
end
render NitroKit::FormSection.new(
title: "Public profile",
description: "These values appear in workspace activity and invitations.",
id: "gallery-hybrid-application-profile-form-section"
) do |section|
section.form do
form_with(
scope: :profile,
url: "#save-profile",
builder: NitroKit::FormBuilder,
id: "gallery-hybrid-application-profile-form"
) do |form|
form.fieldset(legend: "Profile details") do
form.group do
form.field(:name, label: "Name", value: PROFILE.name, required: true)
form.field(:email, as: :email, label: "Email", value: PROFILE.email, required: true)
form.field(:website, as: :url, label: "Website", value: PROFILE.website)
end
end
form.submit("Save profile", id: "gallery-hybrid-application-profile-submit")
end
end
end
end
end
end
render NitroKit::Toast.new(
duration: 600_000,
label: "Account notifications",
html: { id: "gallery-hybrid-application-toast" }
) do |toast|
toast.item(
title: "Profile saved",
description: "Workspace activity now uses the updated public details.",
variant: :success
)
end
end
end
end