identity-vault/app/components/profile_completion.rb
nora f02fceb531
VERSION. TWO. (#42)
* INITIAL SAML SUPPORT WOO YEA BABEY

it works?

* wawa

* mwaow

* b

* WOAG

* mph

* bunch more stuff

* new OAuth screen

* add trust level to oauth apps

* [community oauth] new scopes, validate only some community ones

* bleh

* my info first pass

* sessions and 2fa

* oauth authorizations/revoke

* nuke sms

* fix drift

* remove hcid on ident#edit

* attack our rack?

* session fixation't

* first pass at stepup auth

* eye eighteen en

* fix brand

* think that does it for dev mode!

* add promote to full user button

* first crack at landing page

* better sessions

* better id edit

* better verf

* less css pass 1

* add phone no

* better cssed?

* securité

* switch from slocks

* HCA

* touch last seen at

* session fingerprinting

* improved?

* localize scopes

* add proper oauth welcome

* eepier tutorial

* how long was that like that?!

* common blankslate

* better addresses?

* [backend] fix reprovisioning and promotion

* improve addresses

* ICONS, BEAUTIFUL ICONS

* primary sidebar

* saml welcome?

* new totp flow?

* marginally better login sec

* better print for backup codes!

* MASSIVE LINT PASS

* autocompletes

* woops

* new staging

* actual login code txnl

* no more legacy slack account linking

* fake slack in staging

* no account yet?

* add samls for staging

* fix slack_staging

* lint

* frickin' xmlsec

* no validate keys ?

* AUGH

* ASGJHFGSDJFG

* shoot me

* aieeeee

* SCHEIßE

* no more attempt association on code

* believe in prefers-color-scheme

* fix verf icon

* nuke vestigial aadhaar functionality

thanks deployor!

* fix xmlsec on gh ci

* remove identity (#27)

* move idcon flashes to locale

* remove dead code impersonation logic

h/t ian!

* fix hx-confirm on delete address?

* add missing dev app locale key

* fix #28

* wait, i'm an idiot (#28)

* THERE WE GO

* add paper_trail to more stuff

* red delete btn

* more red delete btns

* THE AUDIT LOGS UPDATE

* yuge lint pass

* Fix icons (#33)

Some icons didn't have a fill nor a viewbox

* weh

* first pass at docs

* memoize docs, fix 404

* [docs] add crappy erb support

* support non-e+ flow

* fix no devmode locale

* DOCS DOCS DOCS

* tldr dev doc

* anti-clickjacking countdown (h/t @J-Meow)

* weh

* get rid of those, they do nothing for us

* dependent destroy

* find user via scim if ent

* save nav channel ids

* fix base onboarding scenario

* only unique among the living

* add SAML debug

* simplify legacy_email

* add UAT env

* we ARE

* add slack to uat

* no entity id?

* fix saml if logged out

* fix scim assignment?

* bring channels into config

* darn it

* try backoff on assign_to_workspace?? this feels problematic

* do the scim docs lie?

* that was dumb

* Revert "do the scim docs lie?"

This reverts commit 69310dbef9476f2103d7a8280966a7fdf732129b.

* Revert "try backoff on assign_to_workspace?? this feels problematic"

This reverts commit 7a5edd67aa3836df1f31d628566e9ea69589c269.

* this some bull shit

* internal tutorial by default

* 18 point something

* fixes: componentize login, no more viewcontext, parse sp-initiated saml better

* one return to.

* just send it

* fix replay bug

* fix URL in welcome docs page (#38)

* simplify login/signup flow, s/faq/terms + privacy

* no more H... we hardly knew you

* first pass at reddening

* red pt. 2

* she's red for an AMAZING reason

* lint pass

* fix tooled tips

* another docs pass

* initial pass at factorybotting docs

* scope diffing for api docs!

* wait we don't need a legend lol

* add verf status to community apps

* fricken lint

* make current_user not nomethod

* move are_we_enterprise_yet to a flipper flag

* improve slack racing

* allow not creating slack

* factorybot in prod for api docs!

* LOL, LMAO

* properly set owner on oauthorizations

* lint pass

* bypass age on existing users

* fix that...

---------

Co-authored-by: Leo <leo@wilkin.xyz>
Co-authored-by: Tom (Deployor) <129990841+deployor@users.noreply.github.com>
Co-authored-by: DaInfLoop <github@dainfloop.is-a.dev>
2025-11-24 10:52:27 -05:00

101 lines
2.8 KiB
Ruby

class Components::ProfileCompletion < ApplicationComponent
def initialize(identity:)
@identity = identity
end
def tasks
@tasks ||= build_tasks
end
def build_tasks
tasks = []
# Verification task
verification_item = Components::VerificationStatusItem.new(identity: @identity)
if verification_item.show?
tasks << {
component: verification_item
}
end
tasks << {
title: I18n.t("home.completion_tasks.phone_number.title"),
description: I18n.t("home.completion_tasks.phone_number.description"),
completed: @identity.phone_number.present?,
url: -> { edit_identity_path },
icon: "message"
}
tasks << {
title: I18n.t("home.completion_tasks.mailing_address.title"),
description: I18n.t("home.completion_tasks.mailing_address.description"),
completed: @identity.primary_address_id.present?,
url: -> { new_address_path },
icon: "email"
}
# Sort tasks: completed ones first (bubbled to top)
tasks.sort_by do |task|
if task[:component]
task[:component].completed? ? 0 : 1
else
task[:completed] ? 0 : 1
end
end
end
def completed_count
tasks.count do |task|
if task[:component]
task[:component].completed?
else
task[:completed]
end
end
end
def total_count = tasks.count
def progress_percentage = (completed_count.to_f / total_count * 100).round
def show? = completed_count < total_count
def view_template
div(class: "profile-completion") do
div(class: "profile-completion-header") do
div(class: "header-content") do
h2 { t "home.completion_tasks.complete_your_profile" }
div(class: "completion-stats") do
span(class: "stats-text") { "#{completed_count} of #{total_count} complete" }
end
end
div(class: "progress-bar-container") do
div(class: "progress-bar", style: "width: #{progress_percentage}%")
end
end
div(class: "profile-tasks") do
tasks.each do |task|
# Handle component-based tasks
if task[:component]
render task[:component]
next
end
# Handle regular tasks - show all tasks, style differently based on completion
task_classes = [ "profile-task" ]
task_classes << "completed" if task[:completed]
a(href: task[:url].call, class: task_classes.join(" ")) do
div(class: "task-icon") { inline_icon(task[:icon], size: 24) }
div(class: "task-content") do
div(class: "task-title") { task[:title] }
div(class: "task-description") { task[:description] }
end
div(class: "task-action") { task[:completed] ? inline_icon("check", size: 16) : "" }
end
end
end
end
end
end