PageSourceSearch

https://site-seeker--ryanhmarcus.replit.app/assets/WorkspaceSettings-hbI_wHdZ.js

js site-seeker--ryanhmarcus.replit.app collected 2026-10-03 03:55:52 UTC 5,812 bytes, 1 lines download raw bytes

1import{e as q,a as r,h as y,f as M,j as e}from"./vendor-react-Dp74XvrO.js";import{u as B,a5 as Y,d,L as m,am as w,e as p,f as x,h,j as u,k as v,I as _,B as k,n as A,v as I}from"./index-CgLRPvlt.js";import{A as S}from"./AppShell-nIiRLkxF.js";import{P as C}from"./PageTransition-DGLZh0US.js";import{S as K}from"./separator-CJLf-8in.js";import{u as O}from"./useBillingPortal-BziE500n.js";import{C as E}from"./credit-card-uUw5EN7-.js";import{M as Q}from"./map-pin-C5N1gAIc.js";import{S as G}from"./save-hac-1gHR.js";import"./vendor-ui-uHkQjjD7.js";import"./vendor-charts-CMwTwPG7.js";import"./vendor-motion-SqhVTVom.js";import"./library-EKiP8R1C.js";import"./settings-NZwTDoSG.js";typeof globalThis.__name>"u"&&(globalThis.__name=function(i){return i});function ie(){const i=q(),{toast:j}=B(),{user:n}=Y(),{openBillingPortal:T,isOpeningPortal:g}=O(),[l,b]=r.useState(""),[o,N]=r.useState(!1),[P,f]=r.useState(!1),{data:s}=y({queryKey:["/api/user"],queryFn:async()=>(await d("GET","/api/user")).json()}),{data:a,isLoading:L}=y({queryKey:["/api/workspace"],queryFn:async()=>(await d("GET","/api/workspace")).json(),enabled:!!s});r.useEffect(()=>{a&&(b(a.name||"Your Subterrix Workspace"),N(a.localContextEnabled||!1))},[a]);const c=M({mutationFn:async t=>(await d("PATCH","/api/workspace",t)).json(),onSuccess:()=>{i.invalidateQueries({queryKey:["/api/workspace"]}),f(!0),j({title:"Settings saved",description:"Your workspace preferences have been updated."}),setTimeout(()=>f(!1),2e3)},onError:()=>{j({title:"Error",description:"Failed to save settings. Please try again.",variant:"destructive"})}}),W=()=>{c.mutate({name:l.trim()||"Your Subterrix Workspace",localContextEnabled:o})},F=a&&(l!==a.name||o!==a.localContextEnabled);return L?e.jsx(C,{children:e.jsx(S,{workspaceName:"Loading...",username:(s==null?void 0:s.name)||(s==null?void 0:s.username),isElite:w(s==null?void 0:s.subscriptionTier)||(s==null?void 0:s.membershipOverride)==="elite",children:e.jsx("div",{className:"flex items-center justify-center py-12",children:e.jsx(m,{className:"w-8 h-8 animate-spin text-slate-400"})})})}):e.jsx(C,{children:e.jsx(S,{workspaceName:(a==null?void 0:a.name)||"Your Subterrix Workspace",username:(s==null?void 0:s.name)||(s==null?void 0:s.username),isElite:w(s==null?void 0:s.subscriptionTier)||(s==null?void 0:s.membershipOverride)==="elite",children:e.jsxs("div",{className:"max-w-2xl mx-auto","data-testid":"settings-page",children:[e.jsxs("div",{className:"mb-6",children:[e.jsx("h1",{className:"text-2xl font-semibold text-slate-900",children:"Settings"}),e.jsx("p",{className:"text-sm text-slate-500 mt-1",children:"Manage your workspace preferences"})]}),e.jsxs("div",{className:"space-y-6",children:[e.jsxs(p,{className:"border-slate-200",children:[e.jsx(x,{className:"pb-3",children:e.jsx(h,{className:"text-lg",children:"Workspace"})}),e.jsx(u,{className:"space-y-4",children:e.jsxs("div",{className:"space-y-2",children:[e.jsx(v,{htmlFor:"workspace-name",children:"Workspace name"}),e.jsx(_,{id:"workspace-name",value:l,onChange:t=>b(t.target.value),placeholder:"Your Subterrix Workspace","data-testid":"input-workspace-name"}),e.jsx("p",{className:"text-xs text-slate-500",children:"This name appears in the top bar of your workspace."})]})})]}),(n==null?void 0:n.hasStripeSubscription)&&e.jsxs(p,{className:"border-slate-200",children:[e.jsx(x,{className:"pb-3",children:e.jsxs(h,{className:"text-lg flex items-center gap-2",children:[e.jsx(E,{className:"w-5 h-5 text-slate-500"}),"Membership & Billing"]})}),e.jsxs(u,{className:"space-y-4",children:[e.jsxs("p",{className:"text-sm text-slate-500",children:["Update the card on file or view past invoices. This opens your secure Stripe billing portal. To switch plans or cancel, go to"," ",e.jsx("a",{href:"/subscription/manage",className:"text-[#1d3557] underline hover:no-underline","data-testid":"link-settings-manage-subscription",children:"Manage subscription"}),"."]}),e.jsxs(k,{onClick:T,disabled:g,className:"bg-[#1d3557] hover:bg-[#152a4a]","data-testid":"button-settings-update-payment-method",children:[g?e.jsx(m,{className:"w-4 h-4 mr-2 animate-spin"}):e.jsx(E,{className:"w-4 h-4 mr-2"}
1),"Update payment method"]})]})]}),e.jsxs(p,{className:"border-slate-200",children:[e.jsx(x,{className:"pb-3",children:e.jsxs(h,{className:"text-lg flex items-center gap-2",children:[e.jsx(Q,{className:"w-5 h-5 text-slate-500"}),"Local Context"]})}),e.jsxs(u,{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(v,{htmlFor:"local-context-toggle",children:"Enable local context"}),e.jsx("p",{className:"text-sm text-slate-500",children:"Show weather and soil data when tied to a project or report"})]}),e.jsx(A,{id:"local-context-toggle",checked:o,onCheckedChange:N,"data-testid":"switch-local-context"})]}),e.jsx(K,{}),e.jsxs("div",{className:"text-sm text-slate-600 space-y-2",children:[e.jsxs("p",{children:["Local context data is ",e.jsx("strong",{children:"never collected or shared"}),"."]}),e.jsx("p",{children:"When enabled, weather and soil information will only appear when explicitly linked to one of your projects or library items."}),e.jsx("p",{className:"text-slate-500",children:"Location approximations are based on your IP address and are never precise or stored."})]})]})]}),e.jsx("div",{className:"flex justify-end",children:e.jsx(k,{className:"bg-[#1d3557] hover:bg-[#152a4a] min-w-[120px]",onClick:W,disabled:!F||c.isPending,"data-testid":"button-save-settings",children:c.isPending?e.jsx(m,{className:"w-4 h-4 mr-2 animate-spin"}):P?e.jsxs(e.Fragment,{children:[e.jsx(I,{className:"w-4 h-4 mr-2"}),"Saved"]}):e.jsxs(e.Fragment,{children:[e.jsx(G,{className:"w-4 h-4 mr-2"}),"Save changes"]})})})]})]})})})}export{ie as default};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.