Ash HQ User Settings Page

prop(current_user, :map, required: true)

data(email_form, :map)
data(password_form, :map)
data(merch_form, :map)
data(address, :string)
data(name, :string)
prop(current_user, :map, required: true)

data(email_form, :map)
data(password_form, :map)
data(merch_form, :map)
data(address, :string)
data(name, :string)
How are these working?
9 Replies
talha-azeem
talha-azeemOP3y ago
Are these the policies defined in user.ex?
frankdugan3
frankdugan33y ago
Those are Surface components, not part of Ash. A lot of here have used Surface, and I think most of us think it's pretty cool, but not really necessary now w/ the most recent Phoenix releases. Personally I'm going back to using plain Phoenix LiveView components how that we have heex, formatting and props.
talha-azeem
talha-azeemOP3y ago
I was just wondering how the User Settings page of Ash HQ was working so i can implement my own 😅
frankdugan3
frankdugan33y ago
Yeah, it's similar to normal Phoenix components, you just need to translate a little of the syntax.
talha-azeem
talha-azeemOP3y ago
data(email_form, :map) This is a surface component but are we defining this email_form somewhere? or are these the surface forms?
frankdugan3
frankdugan33y ago
data is a way to declare state for a LiveComponent/LiveView, docs: https://surface-ui.org/data This allows surface to validate that it is being set in the assigns and what type it should be.
talha-azeem
talha-azeemOP3y ago
yeah i read it. So, if i want to use it through ash resources then i can define these actions and create forms for them, right?
frankdugan3
frankdugan33y ago
Right.
talha-azeem
talha-azeemOP3y ago
as they are settings of user like changing email name or password. these three actions can be defined in user resource. Thank you for the clarification @frankdugan3 🙌🏻

Did you find this page helpful?