chore(ui): remove 4 orphaned views (Dashboard/GenPersona/MySessions/WeakAreas) + mobile polish

- Delete unused views not referenced by router/components (dead files from earlier builds).
- Mobile (640px/460px/380px): nav tabs wrap to a centered full-width row + hide brand at
  <380; logout shows icon-only; stat cards center when collapsing to one column
  (Moreminimore convention); chat bubbles/width handled.
Rebuilt dist.
This commit is contained in:
Macky
2026-08-08 16:12:30 +07:00
parent 15c60ae400
commit b41bfee03b
29 changed files with 50 additions and 250 deletions

View File

@@ -1,4 +1,4 @@
import{k as w,_ as h,l as U,c as r,a as e,m,u as o,j as l,t as n,i as u,w as p,v,E as b,e as f,F as V,q as M,s as k,r as y,o as i,A as C}from"./index-Dm2VwslH.js";import{U as z}from"./users-ksNXFlzl.js";/** import{k as w,_ as h,l as U,c as r,a as e,m,u as o,j as l,t as n,i as u,w as p,v,E as b,e as f,F as V,q as M,s as k,r as y,o as i,A as C}from"./index-C0_i8cDF.js";import{U as z}from"./users-qxBh6IGP.js";/**
* @license lucide-vue-next v1.0.0 - ISC * @license lucide-vue-next v1.0.0 - ISC
* *
* This source code is licensed under the ISC license. * This source code is licensed under the ISC license.

View File

@@ -1,4 +1,4 @@
import{k as x,_ as L,l as M,c as p,a as s,m as i,u as a,j as c,t as e,i as n,n as w,w as f,v as b,p as U,e as N,F as R,q as j,s as A,x as B,r as m,f as E,o as y}from"./index-Dm2VwslH.js";import{U as P}from"./users-ksNXFlzl.js";import{P as S}from"./plus-CAyBY_kw.js";/** import{k as x,_ as L,l as M,c as p,a as s,m as i,u as a,j as c,t as e,i as n,n as w,w as f,v as b,p as U,e as N,F as R,q as j,s as A,x as B,r as m,f as E,o as y}from"./index-C0_i8cDF.js";import{U as P}from"./users-qxBh6IGP.js";import{P as S}from"./plus-BiLb0OIF.js";/**
* @license lucide-vue-next v1.0.0 - ISC * @license lucide-vue-next v1.0.0 - ISC
* *
* This source code is licensed under the ISC license. * This source code is licensed under the ISC license.

View File

@@ -1,4 +1,4 @@
import{k as P,_ as R,l as G,s as S,c as o,m as k,n as D,u as a,a as s,t,i as n,F as T,q as L,j as g,A as w,e as h,w as K,v as $,b as q,h as H,r as d,z as J,C as O,x as U,o as l}from"./index-Dm2VwslH.js";import{T as Y}from"./target-CliUY7kC.js";import{A as Q}from"./arrow-left-Cm4VHcqz.js";/** import{k as P,_ as R,l as G,s as S,c as o,m as k,n as D,u as a,a as s,t,i as n,F as T,q as L,j as g,A as w,e as h,w as K,v as $,b as q,h as H,r as d,z as J,C as O,x as U,o as l}from"./index-C0_i8cDF.js";import{T as Y}from"./target-DoOGVGr0.js";import{A as Q}from"./arrow-left-neyuEczm.js";/**
* @license lucide-vue-next v1.0.0 - ISC * @license lucide-vue-next v1.0.0 - ISC
* *
* This source code is licensed under the ISC license. * This source code is licensed under the ISC license.

View File

@@ -1,4 +1,4 @@
import{k as g,_ as M,c as f,m as d,n as V,a as e,u as l,j as r,t as s,i as o,w as u,v as y,E as k,e as C,x as z,r as v,s as B,g as A,o as x}from"./index-Dm2VwslH.js";import{A as P}from"./arrow-left-Cm4VHcqz.js";/** import{k as g,_ as M,c as f,m as d,n as V,a as e,u as l,j as r,t as s,i as o,w as u,v as y,E as k,e as C,x as z,r as v,s as B,g as A,o as x}from"./index-C0_i8cDF.js";import{A as P}from"./arrow-left-neyuEczm.js";/**
* @license lucide-vue-next v1.0.0 - ISC * @license lucide-vue-next v1.0.0 - ISC
* *
* This source code is licensed under the ISC license. * This source code is licensed under the ISC license.

View File

@@ -1,4 +1,4 @@
import{k as I,_ as F,G as M,o as m,c as f,a as e,t as i,w as o,v as u,E as N,e as _,H as O,r as k,l as q,m as A,n as D,u as c,j as y,i as B,B as J,F as P,q as S,I as H,h as R,s as j,x as K,A as T}from"./index-Dm2VwslH.js";import{U as Q}from"./users-ksNXFlzl.js";import{S as W}from"./sparkles-BXnC3-RA.js";/** import{k as I,_ as F,G as M,o as m,c as f,a as e,t as i,w as o,v as u,E as N,e as _,H as O,r as k,l as q,m as A,n as D,u as c,j as y,i as B,B as J,F as P,q as S,I as H,h as R,s as j,x as K,A as T}from"./index-C0_i8cDF.js";import{U as Q}from"./users-qxBh6IGP.js";import{S as W}from"./sparkles-D66jVNJm.js";/**
* @license lucide-vue-next v1.0.0 - ISC * @license lucide-vue-next v1.0.0 - ISC
* *
* This source code is licensed under the ISC license. * This source code is licensed under the ISC license.

View File

@@ -1,4 +1,4 @@
import{k as e,c as o,a as l,m as n,u as i,j as s,t as r,i as a,D as u,o as d}from"./index-Dm2VwslH.js";import{B as g}from"./book-open-x8tSBc1t.js";import{L as p}from"./layout-dashboard-LQG3ldGP.js";import{T as m}from"./target-CliUY7kC.js";import{S as y}from"./sparkles-BXnC3-RA.js";/** import{k as e,c as o,a as l,m as n,u as i,j as s,t as r,i as a,D as u,o as d}from"./index-C0_i8cDF.js";import{B as g}from"./book-open-E7lWrK45.js";import{L as p}from"./layout-dashboard-C4nLoaIz.js";import{T as m}from"./target-DoOGVGr0.js";import{S as y}from"./sparkles-D66jVNJm.js";/**
* @license lucide-vue-next v1.0.0 - ISC * @license lucide-vue-next v1.0.0 - ISC
* *
* This source code is licensed under the ISC license. * This source code is licensed under the ISC license.

View File

@@ -1 +1 @@
import{_ as b,c as d,a as e,t as s,u as c,i as o,w as y,v as x,b as w,d as k,e as S,r as l,f,g as V,h as B,o as v}from"./index-Dm2VwslH.js";const C={class:"login-wrap"},D={class:"card login-card"},K={class:"pw-wrap"},E=["type"],L=["aria-label"],M={key:0,class:"error",role:"alert"},N=["disabled"],R={key:0,class:"spinner"},U={key:1},q={__name:"Login",setup(H){const g=B(),_=V(),n=l(""),u=l(""),a=l(!1),r=l(""),i=l(!1);async function m(){r.value="",i.value=!0;try{await f.login(n.value.trim(),u.value),f.mustSetup?_.push({path:"/setup"}):_.push(g.query.redirect||"/")}catch{r.value=o.t("loginError")}finally{i.value=!1}}return(h,t)=>(v(),d("div",C,[e("div",D,[e("h1",null,"🎯 "+s(c(o).t("app")),1),t[3]||(t[3]=e("p",{class:"muted",style:{"margin-top":"-8px"}},"Sales training simulator",-1)),e("label",null,s(c(o).t("username")),1),y(e("input",{"onUpdate:modelValue":t[0]||(t[0]=p=>n.value=p),type:"text",autocomplete:"username",onKeyup:w(m,["enter"])},null,544),[[x,n.value]]),e("label",null,s(c(o).t("password")),1),e("div",K,[y(e("input",{"onUpdate:modelValue":t[1]||(t[1]=p=>u.value=p),type:a.value?"text":"password",autocomplete:"current-password",onKeyup:w(m,["enter"])},null,40,E),[[k,u.value]]),e("button",{type:"button",class:"pw-toggle",onClick:t[2]||(t[2]=p=>a.value=!a.value),"aria-label":a.value?"Hide password":"Show password"},s(a.value?"🙈":"👁"),9,L)]),r.value?(v(),d("div",M,s(r.value),1)):S("",!0),e("button",{class:"primary",style:{width:"100%","margin-top":"16px"},disabled:i.value||!n.value||!u.value,onClick:m},[i.value?(v(),d("span",R)):(v(),d("span",U,s(c(o).t("login")),1))],8,N)])]))}},P=b(q,[["__scopeId","data-v-f7904d9f"]]);export{P as default}; import{_ as b,c as d,a as e,t as s,u as c,i as o,w as y,v as x,b as w,d as k,e as S,r as l,f,g as V,h as B,o as v}from"./index-C0_i8cDF.js";const C={class:"login-wrap"},D={class:"card login-card"},K={class:"pw-wrap"},E=["type"],L=["aria-label"],M={key:0,class:"error",role:"alert"},N=["disabled"],R={key:0,class:"spinner"},U={key:1},q={__name:"Login",setup(H){const g=B(),_=V(),n=l(""),u=l(""),a=l(!1),r=l(""),i=l(!1);async function m(){r.value="",i.value=!0;try{await f.login(n.value.trim(),u.value),f.mustSetup?_.push({path:"/setup"}):_.push(g.query.redirect||"/")}catch{r.value=o.t("loginError")}finally{i.value=!1}}return(h,t)=>(v(),d("div",C,[e("div",D,[e("h1",null,"🎯 "+s(c(o).t("app")),1),t[3]||(t[3]=e("p",{class:"muted",style:{"margin-top":"-8px"}},"Sales training simulator",-1)),e("label",null,s(c(o).t("username")),1),y(e("input",{"onUpdate:modelValue":t[0]||(t[0]=p=>n.value=p),type:"text",autocomplete:"username",onKeyup:w(m,["enter"])},null,544),[[x,n.value]]),e("label",null,s(c(o).t("password")),1),e("div",K,[y(e("input",{"onUpdate:modelValue":t[1]||(t[1]=p=>u.value=p),type:a.value?"text":"password",autocomplete:"current-password",onKeyup:w(m,["enter"])},null,40,E),[[k,u.value]]),e("button",{type:"button",class:"pw-toggle",onClick:t[2]||(t[2]=p=>a.value=!a.value),"aria-label":a.value?"Hide password":"Show password"},s(a.value?"🙈":"👁"),9,L)]),r.value?(v(),d("div",M,s(r.value),1)):S("",!0),e("button",{class:"primary",style:{width:"100%","margin-top":"16px"},disabled:i.value||!n.value||!u.value,onClick:m},[i.value?(v(),d("span",R)):(v(),d("span",U,s(c(o).t("login")),1))],8,N)])]))}},P=b(q,[["__scopeId","data-v-f7904d9f"]]);export{P as default};

View File

@@ -1 +1 @@
import{_ as f,l as x,s as v,c as r,a as t,m as b,u as e,j as k,t as s,i as a,e as _,w as B,y as N,F as D,q as S,r as p,z as c,o as i,A as T}from"./index-Dm2VwslH.js";import{L as V}from"./layout-dashboard-LQG3ldGP.js";const z={style:{margin:"0"}},L={key:0,class:"row stat-row"},M={class:"card stat"},j={class:"card stat won"},C={class:"card stat lost"},F={class:"card stat"},q={key:1,class:"card"},A={key:2,class:"card empty-state"},E={class:"card",style:{"margin-top":"20px"}},G={style:{"margin-top":"0"}},I={__name:"MyBoard",setup(H){const o=p([]),u=p([]),m=p(!0),y=c(()=>o.value.length),g=c(()=>o.value.filter(n=>n.my_outcome==="won").length),h=c(()=>o.value.filter(n=>n.my_outcome==="lost").length),w=c(()=>o.value.filter(n=>n.my_outcome==="not_tried").length);return x(async()=>{try{o.value=(await v.myBoard()).board||[],u.value=(await v.mySessions()).sessions||[]}finally{m.value=!1}}),(n,l)=>(i(),r("div",null,[t("div",null,[t("h2",z,[b(e(V),{size:22,"stroke-width":1.8,style:{"vertical-align":"-4px"}}),k(" "+s(e(a).t("myDashboard")),1)]),l[0]||(l[0]=t("div",{class:"muted",style:{"margin-top":"4px","margin-bottom":"16px"}},"สรุปผลการฝึกของตัวคุณเอง — ดูว่าปิดการขายได้กี่ครั้ง ยังฝึกกับใครบ้าง",-1))]),m.value?_("",!0):(i(),r("div",L,[t("div",M,[t("span",null,s(e(a).t("total")),1),t("strong",null,s(y.value),1)]),t("div",j,[t("span",null,s(e(a).t("won")),1),t("strong",null,s(g.value),1)]),t("div",C,[t("span",null,s(e(a).t("lost")),1),t("strong",null,s(h.value),1)]),t("div",F,[t("span",null,s(e(a).t("notTried")),1),t("strong",null,s(w.value),1)])])),m.value?(i(),r("div",q,[...l[1]||(l[1]=[t("div",{class:"skeleton",style:{height:"50px"}},null,-1)])])):o.value.length===0?(i(),r("div",A,[...l[2]||(l[2]=[t("strong",null,"No practice yet",-1),t("span",null,"Go to Training and try closing a sale with a persona.",-1)])])):_("",!0),B(t("div",E,[t("h3",G,s(e(a).t("mySessions")),1),(i(!0),r(D,null,S(u.value,d=>(i(),r("div",{key:d.id,style:{display:"flex","justify-content":"space-between",padding:"8px 0","border-bottom":"1px solid var(--border)"}},[t("span",null,s(d.persona_name),1),t("span",{class:T(["badge",d.outcome])},s(d.outcome==="won"?e(a).t("won"):e(a).t("lost")),3)]))),128))],512),[[N,u.value.length]])]))}},O=f(I,[["__scopeId","data-v-6767b6b8"]]);export{O as default}; import{_ as f,l as x,s as v,c as r,a as t,m as b,u as e,j as k,t as s,i as a,e as _,w as B,y as N,F as D,q as S,r as p,z as c,o as i,A as T}from"./index-C0_i8cDF.js";import{L as V}from"./layout-dashboard-C4nLoaIz.js";const z={style:{margin:"0"}},L={key:0,class:"row stat-row"},M={class:"card stat"},j={class:"card stat won"},C={class:"card stat lost"},F={class:"card stat"},q={key:1,class:"card"},A={key:2,class:"card empty-state"},E={class:"card",style:{"margin-top":"20px"}},G={style:{"margin-top":"0"}},I={__name:"MyBoard",setup(H){const o=p([]),u=p([]),m=p(!0),y=c(()=>o.value.length),g=c(()=>o.value.filter(n=>n.my_outcome==="won").length),h=c(()=>o.value.filter(n=>n.my_outcome==="lost").length),w=c(()=>o.value.filter(n=>n.my_outcome==="not_tried").length);return x(async()=>{try{o.value=(await v.myBoard()).board||[],u.value=(await v.mySessions()).sessions||[]}finally{m.value=!1}}),(n,l)=>(i(),r("div",null,[t("div",null,[t("h2",z,[b(e(V),{size:22,"stroke-width":1.8,style:{"vertical-align":"-4px"}}),k(" "+s(e(a).t("myDashboard")),1)]),l[0]||(l[0]=t("div",{class:"muted",style:{"margin-top":"4px","margin-bottom":"16px"}},"สรุปผลการฝึกของตัวคุณเอง — ดูว่าปิดการขายได้กี่ครั้ง ยังฝึกกับใครบ้าง",-1))]),m.value?_("",!0):(i(),r("div",L,[t("div",M,[t("span",null,s(e(a).t("total")),1),t("strong",null,s(y.value),1)]),t("div",j,[t("span",null,s(e(a).t("won")),1),t("strong",null,s(g.value),1)]),t("div",C,[t("span",null,s(e(a).t("lost")),1),t("strong",null,s(h.value),1)]),t("div",F,[t("span",null,s(e(a).t("notTried")),1),t("strong",null,s(w.value),1)])])),m.value?(i(),r("div",q,[...l[1]||(l[1]=[t("div",{class:"skeleton",style:{height:"50px"}},null,-1)])])):o.value.length===0?(i(),r("div",A,[...l[2]||(l[2]=[t("strong",null,"No practice yet",-1),t("span",null,"Go to Training and try closing a sale with a persona.",-1)])])):_("",!0),B(t("div",E,[t("h3",G,s(e(a).t("mySessions")),1),(i(!0),r(D,null,S(u.value,d=>(i(),r("div",{key:d.id,style:{display:"flex","justify-content":"space-between",padding:"8px 0","border-bottom":"1px solid var(--border)"}},[t("span",null,s(d.persona_name),1),t("span",{class:T(["badge",d.outcome])},s(d.outcome==="won"?e(a).t("won"):e(a).t("lost")),3)]))),128))],512),[[N,u.value.length]])]))}},O=f(I,[["__scopeId","data-v-6767b6b8"]]);export{O as default};

View File

@@ -1 +1 @@
import{_ as T,l as $,c as r,m as d,n as m,a as t,t as s,u as e,i as n,f as g,j as _,e as w,F as y,q as p,h as L,s as N,x as V,r as b,o as a,S as I,A as h,B as A}from"./index-Dm2VwslH.js";import{T as S}from"./target-CliUY7kC.js";import{A as j}from"./arrow-left-Cm4VHcqz.js";const F={class:"row",style:{"align-items":"center"}},q={style:{margin:"0"}},D={class:"muted",style:{"margin-left":"auto"}},E={key:0,class:"card guide"},M={key:1,class:"row",style:{margin:"12px 0",gap:"10px"}},R={class:"primary"},G={class:"grid"},H={class:"row",style:{"justify-content":"space-between"}},J={class:"diff"},K={class:"muted"},O={class:"muted"},Q={class:"muted"},U={class:"muted",style:{"margin-top":"6px"}},W={class:"primary",style:{width:"100%"}},X={class:"primary",style:{width:"100%"}},Y={key:1,class:"muted",style:{"margin-top":"auto","font-size":"12px"}},Z={__name:"Personas",setup(tt){const c=L().params.gid,k=b([]),B=b(!0);async function C(){try{k.value=(await N.listPersonas(c)).personas}finally{B.value=!1}}function z(l){return k.value.filter(i=>i.tier===l)}function P(l){return n.t(l==="A"?"tierA":l==="B"?"tierB":"tierC")}function v(l){return l==="won"?n.t("won"):l==="lost"?n.t("lost"):n.t("notTried")}return $(C),(l,i)=>{const u=V("router-link");return a(),r("div",null,[d(u,{to:"/training",class:"btn-back"},{default:m(()=>[d(e(j),{size:16,"stroke-width":2}),_(" "+s(e(n).t("training")),1)]),_:1}),t("div",F,[t("h2",q,s(e(n).t("personas")),1),t("span",D,s(e(n).t("selectPersona")),1)]),e(g).isAdmin?w("",!0):(a(),r("div",E,[t("strong",null,[d(e(S),{size:17,"stroke-width":1.8,style:{"vertical-align":"-3px"}}),i[0]||(i[0]=_(" วิธีฝึก",-1))]),i[1]||(i[1]=t("ol",{style:{margin:"8px 0 0","padding-left":"20px","line-height":"1.8"}},[t("li",null,"เลือกลูกค้าจำลอง (บุคคลต้นแบบ) คนหนึ่งที่อยากฝึกด้วย"),t("li",null,"ระดับ A ง่ายสุด → ระดับ C ยากสุด (ดูจากดาว ★ ความยาก)"),t("li",null,"กดปุ่มสำหรับฝึกแชทกับลูกค้าคนนั้น (ฝึกได้คนละครั้งเท่านั้น)")],-1))])),e(g).isAdmin?(a(),r("div",M,[d(u,{to:`/admin/groups/${e(c)}/edit`},{default:m(()=>[t("button",R,[d(e(I),{size:18,"stroke-width":1.8}),_(" "+s(e(n).t("managePersonas")),1)])]),_:1},8,["to"]),i[2]||(i[2]=t("span",{class:"muted"},"Admin: จัดการรายละเอียดบุคคลต้นแบบได้ที่นี่",-1))])):w("",!0),(a(),r(y,null,p(["A","B","C"],f=>t("div",{key:f,style:{margin:"20px 0"}},[t("h4",null,s(P(f)),1),t("div",G,[(a(!0),r(y,null,p(z(f),o=>(a(),r("div",{key:o.id,class:"card pcard lift"},[t("div",H,[t("strong",null,s(o.name),1),t("span",{class:h(["badge",o.my_outcome])},s(v(o.my_outcome)),3)]),t("div",J,[(a(),r(y,null,p(5,x=>t("span",{key:x,class:h(["star",{on:x<=(o.difficulty||1)}])},"★",2)),64)),t("span",K,s(e(n).t("difficulty"))+" "+s(o.difficulty||1)+"/5",1)]),t("div",O,[_(s(o.profession)+" · "+s(o.age_group)+" · "+s(o.location),1),i[3]||(i[3]=t("br",null,null,-1)),t("span",{class:h(["badge",o.channel])},s(o.channel),3),t("span",Q," · "+s(o.initiation_mode==="seller"?e(n).t("sellerInitiated"):e(n).t("customerInitiated")),1)]),t("div",U,s(o.product_context),1),e(g).isAdmin?(a(),A(u,{key:0,to:`/groups/${e(c)}/chat/${o.id}`,style:{"margin-top":"auto"}},{default:m(()=>[t("button",W,s(e(n).t("chat")),1)]),_:1},8,["to"])):(a(),r(y,{key:1},[o.my_outcome==="not_tried"?(a(),A(u,{key:0,to:`/groups/${e(c)}/chat/${o.id}`,style:{"margin-top":"auto"}},{default:m(()=>[t("button",X,s(e(n).t("chat")),1)]),_:1},8,["to"])):(a(),r("div",Y,"✓ "+s(e(n).t("trained"))+" ("+s(v(o.my_outcome))+")",1))],64))]))),128))])])),64))])}}},at=T(Z,[["__scopeId","data-v-46d50c99"]]);export{at as default}; import{_ as T,l as $,c as r,m as d,n as m,a as t,t as s,u as e,i as n,f as g,j as _,e as w,F as y,q as p,h as L,s as N,x as V,r as b,o as a,S as I,A as h,B as A}from"./index-C0_i8cDF.js";import{T as S}from"./target-DoOGVGr0.js";import{A as j}from"./arrow-left-neyuEczm.js";const F={class:"row",style:{"align-items":"center"}},q={style:{margin:"0"}},D={class:"muted",style:{"margin-left":"auto"}},E={key:0,class:"card guide"},M={key:1,class:"row",style:{margin:"12px 0",gap:"10px"}},R={class:"primary"},G={class:"grid"},H={class:"row",style:{"justify-content":"space-between"}},J={class:"diff"},K={class:"muted"},O={class:"muted"},Q={class:"muted"},U={class:"muted",style:{"margin-top":"6px"}},W={class:"primary",style:{width:"100%"}},X={class:"primary",style:{width:"100%"}},Y={key:1,class:"muted",style:{"margin-top":"auto","font-size":"12px"}},Z={__name:"Personas",setup(tt){const c=L().params.gid,k=b([]),B=b(!0);async function C(){try{k.value=(await N.listPersonas(c)).personas}finally{B.value=!1}}function z(l){return k.value.filter(i=>i.tier===l)}function P(l){return n.t(l==="A"?"tierA":l==="B"?"tierB":"tierC")}function v(l){return l==="won"?n.t("won"):l==="lost"?n.t("lost"):n.t("notTried")}return $(C),(l,i)=>{const u=V("router-link");return a(),r("div",null,[d(u,{to:"/training",class:"btn-back"},{default:m(()=>[d(e(j),{size:16,"stroke-width":2}),_(" "+s(e(n).t("training")),1)]),_:1}),t("div",F,[t("h2",q,s(e(n).t("personas")),1),t("span",D,s(e(n).t("selectPersona")),1)]),e(g).isAdmin?w("",!0):(a(),r("div",E,[t("strong",null,[d(e(S),{size:17,"stroke-width":1.8,style:{"vertical-align":"-3px"}}),i[0]||(i[0]=_(" วิธีฝึก",-1))]),i[1]||(i[1]=t("ol",{style:{margin:"8px 0 0","padding-left":"20px","line-height":"1.8"}},[t("li",null,"เลือกลูกค้าจำลอง (บุคคลต้นแบบ) คนหนึ่งที่อยากฝึกด้วย"),t("li",null,"ระดับ A ง่ายสุด → ระดับ C ยากสุด (ดูจากดาว ★ ความยาก)"),t("li",null,"กดปุ่มสำหรับฝึกแชทกับลูกค้าคนนั้น (ฝึกได้คนละครั้งเท่านั้น)")],-1))])),e(g).isAdmin?(a(),r("div",M,[d(u,{to:`/admin/groups/${e(c)}/edit`},{default:m(()=>[t("button",R,[d(e(I),{size:18,"stroke-width":1.8}),_(" "+s(e(n).t("managePersonas")),1)])]),_:1},8,["to"]),i[2]||(i[2]=t("span",{class:"muted"},"Admin: จัดการรายละเอียดบุคคลต้นแบบได้ที่นี่",-1))])):w("",!0),(a(),r(y,null,p(["A","B","C"],f=>t("div",{key:f,style:{margin:"20px 0"}},[t("h4",null,s(P(f)),1),t("div",G,[(a(!0),r(y,null,p(z(f),o=>(a(),r("div",{key:o.id,class:"card pcard lift"},[t("div",H,[t("strong",null,s(o.name),1),t("span",{class:h(["badge",o.my_outcome])},s(v(o.my_outcome)),3)]),t("div",J,[(a(),r(y,null,p(5,x=>t("span",{key:x,class:h(["star",{on:x<=(o.difficulty||1)}])},"★",2)),64)),t("span",K,s(e(n).t("difficulty"))+" "+s(o.difficulty||1)+"/5",1)]),t("div",O,[_(s(o.profession)+" · "+s(o.age_group)+" · "+s(o.location),1),i[3]||(i[3]=t("br",null,null,-1)),t("span",{class:h(["badge",o.channel])},s(o.channel),3),t("span",Q," · "+s(o.initiation_mode==="seller"?e(n).t("sellerInitiated"):e(n).t("customerInitiated")),1)]),t("div",U,s(o.product_context),1),e(g).isAdmin?(a(),A(u,{key:0,to:`/groups/${e(c)}/chat/${o.id}`,style:{"margin-top":"auto"}},{default:m(()=>[t("button",W,s(e(n).t("chat")),1)]),_:1},8,["to"])):(a(),r(y,{key:1},[o.my_outcome==="not_tried"?(a(),A(u,{key:0,to:`/groups/${e(c)}/chat/${o.id}`,style:{"margin-top":"auto"}},{default:m(()=>[t("button",X,s(e(n).t("chat")),1)]),_:1},8,["to"])):(a(),r("div",Y,"✓ "+s(e(n).t("trained"))+" ("+s(v(o.my_outcome))+")",1))],64))]))),128))])])),64))])}}},at=T(Z,[["__scopeId","data-v-46d50c99"]]);export{at as default};

View File

@@ -1,4 +1,4 @@
import{k as z,_ as T,r as c,f as i,c as h,a as e,m as k,u as a,S as $,j as v,t as o,i as s,w as x,v as b,e as V,A as S,s as U,o as w}from"./index-Dm2VwslH.js";/** import{k as z,_ as T,r as c,f as i,c as h,a as e,m as k,u as a,S as $,j as v,t as o,i as s,w as x,v as b,e as V,A as S,s as U,o as w}from"./index-C0_i8cDF.js";/**
* @license lucide-vue-next v1.0.0 - ISC * @license lucide-vue-next v1.0.0 - ISC
* *
* This source code is licensed under the ISC license. * This source code is licensed under the ISC license.

View File

@@ -1 +1 @@
import{_ as x,c as v,a as e,t,u as s,i as a,j as S,f as _,w,v as f,b as y,e as V,r,g as K,o as m}from"./index-Dm2VwslH.js";const T={class:"setup-wrap"},B={class:"card setup-card"},N={class:"muted"},U={key:0,class:"error",role:"alert"},C=["disabled"],D={key:0,class:"spinner"},M={key:1},P={__name:"Setup",setup(j){const k=K(),i=r(""),l=r(""),p=r(""),o=r(""),d=r(!1);async function c(){if(o.value="",l.value.length<4){o.value=a.t("passwordTooShort");return}if(l.value!==p.value){o.value=a.t("passwordMismatch");return}d.value=!0;try{await _.finishSetup(i.value.trim(),l.value),k.push("/")}catch(h){o.value=h.message}finally{d.value=!1}}return(h,u)=>{var b,g;return m(),v("div",T,[e("div",B,[e("h1",null,"🔐 "+t(s(a).t("setupTitle")),1),e("p",N,[S(t(s(a).t("setupSubtitle"))+" ",1),e("strong",null,t(((b=s(_).user)==null?void 0:b.name)||((g=s(_).user)==null?void 0:g.username)),1)]),e("label",null,t(s(a).t("email")),1),w(e("input",{"onUpdate:modelValue":u[0]||(u[0]=n=>i.value=n),type:"email",autocomplete:"email",onKeyup:y(c,["enter"])},null,544),[[f,i.value]]),e("label",null,t(s(a).t("newPassword")),1),w(e("input",{"onUpdate:modelValue":u[1]||(u[1]=n=>l.value=n),type:"password",autocomplete:"new-password",onKeyup:y(c,["enter"])},null,544),[[f,l.value]]),e("label",null,t(s(a).t("confirmPassword")),1),w(e("input",{"onUpdate:modelValue":u[2]||(u[2]=n=>p.value=n),type:"password",autocomplete:"new-password",onKeyup:y(c,["enter"])},null,544),[[f,p.value]]),o.value?(m(),v("div",U,t(o.value),1)):V("",!0),e("button",{class:"primary",style:{width:"100%","margin-top":"16px"},disabled:d.value||!i.value||!l.value||l.value!==p.value,onClick:c},[d.value?(m(),v("span",D)):(m(),v("span",M,t(s(a).t("save")),1))],8,C)])])}}},I=x(P,[["__scopeId","data-v-f190e120"]]);export{I as default}; import{_ as x,c as v,a as e,t,u as s,i as a,j as S,f as _,w,v as f,b as y,e as V,r,g as K,o as m}from"./index-C0_i8cDF.js";const T={class:"setup-wrap"},B={class:"card setup-card"},N={class:"muted"},U={key:0,class:"error",role:"alert"},C=["disabled"],D={key:0,class:"spinner"},M={key:1},P={__name:"Setup",setup(j){const k=K(),i=r(""),l=r(""),p=r(""),o=r(""),d=r(!1);async function c(){if(o.value="",l.value.length<4){o.value=a.t("passwordTooShort");return}if(l.value!==p.value){o.value=a.t("passwordMismatch");return}d.value=!0;try{await _.finishSetup(i.value.trim(),l.value),k.push("/")}catch(h){o.value=h.message}finally{d.value=!1}}return(h,u)=>{var b,g;return m(),v("div",T,[e("div",B,[e("h1",null,"🔐 "+t(s(a).t("setupTitle")),1),e("p",N,[S(t(s(a).t("setupSubtitle"))+" ",1),e("strong",null,t(((b=s(_).user)==null?void 0:b.name)||((g=s(_).user)==null?void 0:g.username)),1)]),e("label",null,t(s(a).t("email")),1),w(e("input",{"onUpdate:modelValue":u[0]||(u[0]=n=>i.value=n),type:"email",autocomplete:"email",onKeyup:y(c,["enter"])},null,544),[[f,i.value]]),e("label",null,t(s(a).t("newPassword")),1),w(e("input",{"onUpdate:modelValue":u[1]||(u[1]=n=>l.value=n),type:"password",autocomplete:"new-password",onKeyup:y(c,["enter"])},null,544),[[f,l.value]]),e("label",null,t(s(a).t("confirmPassword")),1),w(e("input",{"onUpdate:modelValue":u[2]||(u[2]=n=>p.value=n),type:"password",autocomplete:"new-password",onKeyup:y(c,["enter"])},null,544),[[f,p.value]]),o.value?(m(),v("div",U,t(o.value),1)):V("",!0),e("button",{class:"primary",style:{width:"100%","margin-top":"16px"},disabled:d.value||!i.value||!l.value||l.value!==p.value,onClick:c},[d.value?(m(),v("span",D)):(m(),v("span",M,t(s(a).t("save")),1))],8,C)])])}}},I=x(P,[["__scopeId","data-v-f190e120"]]);export{I as default};

View File

@@ -1 +1 @@
import{_ as w,l as b,s as A,f as d,c as l,a as t,m as c,u as s,j as _,t as e,i as n,n as m,B as h,e as f,F as B,q as C,r as g,x as N,o as i,A as k}from"./index-Dm2VwslH.js";import{T as P}from"./target-CliUY7kC.js";import{B as T}from"./book-open-x8tSBc1t.js";import{P as z}from"./plus-CAyBY_kw.js";const V={class:"row",style:{"align-items":"center","margin-bottom":"16px"}},j={style:{margin:"0"}},F={class:"row",style:{"margin-left":"auto",gap:"10px"}},L={class:"soft"},S={class:"primary"},$={class:"muted"},q={key:0,class:"card",style:{"min-height":"80px"}},D={key:1,class:"card empty-state"},E={key:0},G={key:1},I={class:"grid"},M={class:"card lift train-card"},O={class:"row",style:{"justify-content":"space-between"}},H={class:"muted",style:{margin:"6px 0 12px"}},J={class:"row",style:{gap:"8px"}},K={class:"muted"},Q={class:"primary",style:{width:"100%","margin-top":"12px"}},R={__name:"Training",setup(U){const u=g([]),y=g(!0);function v(a){return a.sales_kit&&a.sales_kit.productName||a.input&&a.input.product||""}function x(a){return a.personas||a.persona_count||0}return b(async()=>{try{const a=(await A.listGroups()).groups||[];u.value=d.isAdmin?a:a.filter(r=>r.status==="ready")}finally{y.value=!1}}),(a,r)=>{const p=N("router-link");return i(),l("div",null,[t("div",V,[t("h2",j,[c(s(P),{size:22,"stroke-width":1.8,style:{"vertical-align":"-4px"}}),_(" "+e(s(n).t("training")),1)]),t("div",F,[c(p,{to:"/guide"},{default:m(()=>[t("button",L,[c(s(T),{size:18,"stroke-width":1.8}),r[0]||(r[0]=_(" คู่มือ",-1))])]),_:1}),s(d).isAdmin?(i(),h(p,{key:0,to:"/admin/new-group"},{default:m(()=>[t("button",S,[c(s(z),{size:18,"stroke-width":2}),_(" "+e(s(n).t("addProduct")),1)])]),_:1})):f("",!0)])]),t("p",$,e(s(n).t("trainingSubtitle")),1),y.value?(i(),l("div",q,[...r[1]||(r[1]=[t("div",{class:"skeleton",style:{height:"50px"}},null,-1)])])):u.value.length===0?(i(),l("div",D,[t("strong",null,e(s(n).t("noTraining")),1),s(d).isAdmin?(i(),l("span",E,'Click "'+e(s(n).t("addProduct"))+'" to create a persona group.',1)):(i(),l("span",G,"Ask an admin to create a persona group first."))])):f("",!0),t("div",I,[(i(!0),l(B,null,C(u.value,o=>(i(),h(p,{key:o.id,to:s(d).isAdmin?`/admin/groups/${o.id}/edit`:`/groups/${o.id}/personas`,style:{"text-decoration":"none"}},{default:m(()=>[t("div",M,[t("div",O,[t("strong",null,e(o.title),1),t("span",{class:k(["badge",o.status==="ready"?"ready":"draft"])},e(o.status),3)]),t("div",H,e(v(o)),1),t("div",J,[t("span",{class:k(["badge",o.channel||"line"])},e(o.channel||"line"),3),t("span",K,e(x(o))+" "+e(s(n).t("personas").toLowerCase()),1)]),t("button",Q,e(s(d).isAdmin?o.status==="ready"?s(n).t("managePersonas"):s(n).t("analyze"):s(n).t("selectPersona")),1)])]),_:2},1032,["to"]))),128))])])}}},tt=w(R,[["__scopeId","data-v-e39df241"]]);export{tt as default}; import{_ as w,l as b,s as A,f as d,c as l,a as t,m as c,u as s,j as _,t as e,i as n,n as m,B as h,e as f,F as B,q as C,r as g,x as N,o as i,A as k}from"./index-C0_i8cDF.js";import{T as P}from"./target-DoOGVGr0.js";import{B as T}from"./book-open-E7lWrK45.js";import{P as z}from"./plus-BiLb0OIF.js";const V={class:"row",style:{"align-items":"center","margin-bottom":"16px"}},j={style:{margin:"0"}},F={class:"row",style:{"margin-left":"auto",gap:"10px"}},L={class:"soft"},S={class:"primary"},$={class:"muted"},q={key:0,class:"card",style:{"min-height":"80px"}},D={key:1,class:"card empty-state"},E={key:0},G={key:1},I={class:"grid"},M={class:"card lift train-card"},O={class:"row",style:{"justify-content":"space-between"}},H={class:"muted",style:{margin:"6px 0 12px"}},J={class:"row",style:{gap:"8px"}},K={class:"muted"},Q={class:"primary",style:{width:"100%","margin-top":"12px"}},R={__name:"Training",setup(U){const u=g([]),y=g(!0);function v(a){return a.sales_kit&&a.sales_kit.productName||a.input&&a.input.product||""}function x(a){return a.personas||a.persona_count||0}return b(async()=>{try{const a=(await A.listGroups()).groups||[];u.value=d.isAdmin?a:a.filter(r=>r.status==="ready")}finally{y.value=!1}}),(a,r)=>{const p=N("router-link");return i(),l("div",null,[t("div",V,[t("h2",j,[c(s(P),{size:22,"stroke-width":1.8,style:{"vertical-align":"-4px"}}),_(" "+e(s(n).t("training")),1)]),t("div",F,[c(p,{to:"/guide"},{default:m(()=>[t("button",L,[c(s(T),{size:18,"stroke-width":1.8}),r[0]||(r[0]=_(" คู่มือ",-1))])]),_:1}),s(d).isAdmin?(i(),h(p,{key:0,to:"/admin/new-group"},{default:m(()=>[t("button",S,[c(s(z),{size:18,"stroke-width":2}),_(" "+e(s(n).t("addProduct")),1)])]),_:1})):f("",!0)])]),t("p",$,e(s(n).t("trainingSubtitle")),1),y.value?(i(),l("div",q,[...r[1]||(r[1]=[t("div",{class:"skeleton",style:{height:"50px"}},null,-1)])])):u.value.length===0?(i(),l("div",D,[t("strong",null,e(s(n).t("noTraining")),1),s(d).isAdmin?(i(),l("span",E,'Click "'+e(s(n).t("addProduct"))+'" to create a persona group.',1)):(i(),l("span",G,"Ask an admin to create a persona group first."))])):f("",!0),t("div",I,[(i(!0),l(B,null,C(u.value,o=>(i(),h(p,{key:o.id,to:s(d).isAdmin?`/admin/groups/${o.id}/edit`:`/groups/${o.id}/personas`,style:{"text-decoration":"none"}},{default:m(()=>[t("div",M,[t("div",O,[t("strong",null,e(o.title),1),t("span",{class:k(["badge",o.status==="ready"?"ready":"draft"])},e(o.status),3)]),t("div",H,e(v(o)),1),t("div",J,[t("span",{class:k(["badge",o.channel||"line"])},e(o.channel||"line"),3),t("span",K,e(x(o))+" "+e(s(n).t("personas").toLowerCase()),1)]),t("button",Q,e(s(d).isAdmin?o.status==="ready"?s(n).t("managePersonas"):s(n).t("analyze"):s(n).t("selectPersona")),1)])]),_:2},1032,["to"]))),128))])])}}},tt=w(R,[["__scopeId","data-v-e39df241"]]);export{tt as default};

View File

@@ -1,4 +1,4 @@
import{k as e}from"./index-Dm2VwslH.js";/** import{k as e}from"./index-C0_i8cDF.js";/**
* @license lucide-vue-next v1.0.0 - ISC * @license lucide-vue-next v1.0.0 - ISC
* *
* This source code is licensed under the ISC license. * This source code is licensed under the ISC license.

View File

@@ -1,4 +1,4 @@
import{k as a}from"./index-Dm2VwslH.js";/** import{k as a}from"./index-C0_i8cDF.js";/**
* @license lucide-vue-next v1.0.0 - ISC * @license lucide-vue-next v1.0.0 - ISC
* *
* This source code is licensed under the ISC license. * This source code is licensed under the ISC license.

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -1,4 +1,4 @@
import{k as t}from"./index-Dm2VwslH.js";/** import{k as t}from"./index-C0_i8cDF.js";/**
* @license lucide-vue-next v1.0.0 - ISC * @license lucide-vue-next v1.0.0 - ISC
* *
* This source code is licensed under the ISC license. * This source code is licensed under the ISC license.

View File

@@ -1,4 +1,4 @@
import{k as e}from"./index-Dm2VwslH.js";/** import{k as e}from"./index-C0_i8cDF.js";/**
* @license lucide-vue-next v1.0.0 - ISC * @license lucide-vue-next v1.0.0 - ISC
* *
* This source code is licensed under the ISC license. * This source code is licensed under the ISC license.

View File

@@ -1,4 +1,4 @@
import{k as a}from"./index-Dm2VwslH.js";/** import{k as a}from"./index-C0_i8cDF.js";/**
* @license lucide-vue-next v1.0.0 - ISC * @license lucide-vue-next v1.0.0 - ISC
* *
* This source code is licensed under the ISC license. * This source code is licensed under the ISC license.

View File

@@ -1,4 +1,4 @@
import{k as c}from"./index-Dm2VwslH.js";/** import{k as c}from"./index-C0_i8cDF.js";/**
* @license lucide-vue-next v1.0.0 - ISC * @license lucide-vue-next v1.0.0 - ISC
* *
* This source code is licensed under the ISC license. * This source code is licensed under the ISC license.

View File

@@ -1,4 +1,4 @@
import{k as e}from"./index-Dm2VwslH.js";/** import{k as e}from"./index-C0_i8cDF.js";/**
* @license lucide-vue-next v1.0.0 - ISC * @license lucide-vue-next v1.0.0 - ISC
* *
* This source code is licensed under the ISC license. * This source code is licensed under the ISC license.

View File

@@ -4,8 +4,8 @@
<meta charset="UTF-8" /> <meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Sales Trainer</title> <title>Sales Trainer</title>
<script type="module" crossorigin src="/assets/index-Dm2VwslH.js"></script> <script type="module" crossorigin src="/assets/index-C0_i8cDF.js"></script>
<link rel="stylesheet" crossorigin href="/assets/index-Bu7f-IE2.css"> <link rel="stylesheet" crossorigin href="/assets/index-B9WjPRES.css">
</head> </head>
<body> <body>
<div id="app"></div> <div id="app"></div>

View File

@@ -18,7 +18,7 @@
<router-link to="/settings" class="icon-btn" :title="i18n.t('settings')"> <router-link to="/settings" class="icon-btn" :title="i18n.t('settings')">
<SettingsIcon :size="20" :stroke-width="1.8" /> <SettingsIcon :size="20" :stroke-width="1.8" />
</router-link> </router-link>
<button @click="logout" class="logout-btn"><LogOut :size="18" :stroke-width="1.8" /> {{ i18n.t('logout') }}</button> <button @click="logout" class="logout-btn"><LogOut :size="18" :stroke-width="1.8" /> <span class="txt">{{ i18n.t('logout') }}</span></button>
</div> </div>
</nav> </nav>
<main class="main"> <main class="main">
@@ -83,8 +83,16 @@ onMounted(() => {
.icon-btn:hover { background: #f1f3f9; } .icon-btn:hover { background: #f1f3f9; }
.main { max-width: 1080px; margin: 0 auto; padding: 24px; } .main { max-width: 1080px; margin: 0 auto; padding: 24px; }
@media (max-width: 640px) { @media (max-width: 640px) {
.topnav { padding: 10px 12px; } .topnav { padding: 8px 10px; gap: 8px; }
.tab { padding: 8px 12px; font-size: 13px; } .brand { font-size: 14px; }
.logout-btn span { display: none; } .tabs { order: 3; width: 100%; justify-content: center; }
.tab { padding: 6px 10px; font-size: 12px; flex: 1; text-align: center; }
.nav-right { margin-left: auto; }
.lang { padding: 6px 8px; font-size: 12px; }
.logout-btn { padding: 6px 8px; }
.logout-btn .txt { display: none; }
}
@media (max-width: 380px) {
.brand { display: none; }
} }
</style> </style>

View File

@@ -155,4 +155,11 @@ button:disabled { opacity: .5; cursor: not-allowed; box-shadow: none; }
.main { padding: 16px; } .main { padding: 16px; }
.row { gap: 10px; } .row { gap: 10px; }
.msg-seller, .msg-customer { max-width: 84%; } .msg-seller, .msg-customer { max-width: 84%; }
/* Moreminimore convention: centered content when a section collapses to one column */
.stat-row > .card, .row.stat > .card { flex: 1 1 40%; text-align: center; }
.stat div { text-align: center; }
}
@media (max-width: 460px) {
.row.stat, .stat-row, .row.stat-row { justify-content: center; }
.stat-row > .card { min-width: 42%; }
} }

View File

@@ -1,71 +0,0 @@
<template>
<div>
<div class="row" style="margin-bottom:16px">
<h2 style="margin:0">{{ i18n.t('dashboard') }}</h2>
<div style="margin-left:auto" v-if="auth.isAdmin">
<router-link to="/admin/new-group"><button class="primary">{{ i18n.t('groupBuilder') }} +</button></router-link>
</div>
</div>
<div class="row" v-if="auth.isAdmin" style="gap:16px;margin-bottom:20px">
<router-link to="/admin/users" style="text-decoration:none"><div class="card link-card">👥 {{ i18n.t('users') }}</div></router-link>
<router-link to="/admin/analytics" style="text-decoration:none"><div class="card link-card">📊 {{ i18n.t('analytics') }}</div></router-link>
</div>
<div v-if="auth.role === 'user'" class="row" style="gap:16px;margin-bottom:20px">
<router-link to="/my/sessions" style="text-decoration:none"><div class="card link-card">🎯 {{ i18n.t('myTraining') }}</div></router-link>
<router-link to="/my/weak-areas" style="text-decoration:none"><div class="card link-card"> {{ i18n.t('weakAreas') }}</div></router-link>
<router-link to="/my/generate" style="text-decoration:none"><div class="card link-card"> {{ i18n.t('generatePersona') }}</div></router-link>
</div>
<h3>{{ i18n.t('groups') }}</h3>
<div v-if="loading" class="card" style="min-height:120px">
<div class="skeleton" style="height:60px"></div>
<div class="skeleton" style="height:60px;margin-top:10px"></div>
</div>
<div v-else-if="groups.length === 0" class="card empty-state">
<strong>{{ auth.isAdmin ? 'No persona groups yet' : 'No groups available' }}</strong>
<span v-if="auth.isAdmin">{{ i18n.t('groupBuilder') }} to start.</span>
<span v-else>Ask an admin to create a group.</span>
</div>
<div class="grid">
<div v-for="g in groups" :key="g.id" class="card group-card lift">
<div class="row" style="justify-content:space-between">
<strong>{{ g.title }}</strong>
<span class="badge" :class="g.status">{{ g.status }}</span>
</div>
<div class="muted" style="margin:6px 0 12px">{{ (g.sales_kit && g.sales_kit.productName) || (g.input && g.input.product) || '' }}</div>
<router-link v-if="auth.isAdmin" :to="`/admin/groups/${g.id}/edit`">
<button>{{ i18n.t('personas') }} / {{ i18n.t('create') }}</button>
</router-link>
<router-link v-else-if="g.status === 'ready'" :to="`/groups/${g.id}/personas`">
<button class="primary">{{ i18n.t('selectPersona') }}</button>
</router-link>
</div>
</div>
</div>
</template>
<script setup>
import { onMounted, ref } from 'vue'
import { api } from '../api'
import { auth } from '../store/auth'
import { i18n } from '../i18n'
const groups = ref([])
const loading = ref(true)
onMounted(async () => {
try {
groups.value = (await api.listGroups()).groups
} finally {
loading.value = false
}
})
</script>
<style scoped>
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.group-card { display: flex; flex-direction: column; }
.group-card a { margin-top: auto; }
.link-card { text-align: center; min-width: 150px; }
</style>

View File

@@ -1,77 +0,0 @@
<template>
<div>
<h2>{{ i18n.t('generatePersona') }}</h2>
<div class="card" style="margin-bottom:16px">
<label>Mode</label>
<div class="row">
<button :class="{ active: mode === 'manual' }" @click="mode = 'manual'"> {{ i18n.t('manual') }}</button>
<button :class="{ active: mode === 'weak-area' }" @click="mode = 'weak-area'">🔒 Weak-area lock</button>
</div>
<template v-if="mode === 'manual'">
<label>Describe the persona you want to practice against</label>
<textarea v-model="spec" rows="4" placeholder="e.g. a price-hardball restaurant owner on LINE who stalls when I bring up costs"></textarea>
</template>
<template v-else>
<p class="muted">The system will analyze your losses and auto-generate a harder persona targeting your weak points.</p>
</template>
<button class="primary" style="margin-top:16px" :disabled="busy || (mode === 'manual' && !spec.trim())" @click="gen">
{{ busy ? '...' : i18n.t('generatePersona') }}
</button>
<div class="error" v-if="error">{{ error }}</div>
</div>
<h3>My personas</h3>
<div class="grid">
<div v-for="p in mine" :key="p.id" class="card pcard">
<strong>{{ p.name }}</strong>
<span class="badge" :class="p.tier">Tier {{ p.tier }}</span>
<div class="muted">{{ p.profession }} · {{ p.age_group }}</div>
<router-link :to="`/groups/${myGid}/chat/${p.id}`" style="margin-top:auto">
<button class="primary" style="width:100%">{{ i18n.t('chat') }}</button>
</router-link>
</div>
</div>
</div>
</template>
<script setup>
import { onMounted, ref } from 'vue'
import { useRoute } from 'vue-router'
import { api } from '../api'
import { i18n } from '../i18n'
const route = useRoute()
const mode = ref(route.query.mode === 'weak' ? 'weak-area' : 'manual')
const spec = ref('')
const busy = ref(false)
const error = ref('')
const mine = ref([])
const myGid = ref(null)
async function loadMine() {
const d = await api.myPersonas()
myGid.value = d.group.id
mine.value = d.personas
}
onMounted(loadMine)
async function gen() {
busy.value = true
error.value = ''
try {
const body = mode.value === 'weak-area'
? { mode: 'weak-area', spec: {} }
: { mode: 'manual', spec: { description: spec.value } }
await api.generatePersona(body)
await loadMine()
} catch (e) { error.value = e.message }
finally { busy.value = false }
}
</script>
<style scoped>
button.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.pcard { display: flex; flex-direction: column; min-height: 140px; }
</style>

View File

@@ -1,28 +0,0 @@
<template>
<div>
<h2>{{ i18n.t('myTraining') }}</h2>
<div class="card" v-for="s in sessions" :key="s.id" style="margin-bottom:10px">
<div class="row" style="justify-content:space-between">
<strong>{{ s.persona_name }}</strong>
<span class="badge" :class="s.outcome || 'not_tried'">{{ s.outcome || '—' }}</span>
</div>
<div class="muted">{{ s.persona_id }} · {{ (new Date(s.created_at)).toLocaleString() }}</div>
<div v-if="s.debrief" class="muted" style="margin-top:4px">
Score {{ s.debrief.score }} {{ s.debrief.why }}
</div>
</div>
<div v-if="sessions.length === 0" class="card empty-state">
<strong>No training sessions yet</strong>
<span>Pick a persona from a group and practice closing a sale.</span>
</div>
</div>
</template>
<script setup>
import { onMounted, ref } from 'vue'
import { api } from '../api'
import { i18n } from '../i18n'
const sessions = ref([])
onMounted(async () => { sessions.value = (await api.mySessions()).sessions })
</script>

View File

@@ -1,39 +0,0 @@
<template>
<div>
<div class="row" style="align-items:center">
<h2 style="margin:0">{{ i18n.t('weakAreas') }}</h2>
<router-link :to="`/my/generate?mode=weak`" style="margin-left:auto"><button class="primary">🔒 Generate a lock persona</button></router-link>
</div>
<div class="row" style="gap:16px;margin:16px 0">
<div class="card stat"><div>Wins</div><strong>{{ insight.wins }}</strong></div>
<div class="card stat"><div>Losses</div><strong>{{ insight.losses }}</strong></div>
<div class="card stat"><div>Total</div><strong>{{ insight.total_sessions }}</strong></div>
</div>
<div v-for="g in insight.by_tier" :key="g.value" class="card" style="margin-bottom:8px">
<span class="badge" :class="g.value">Tier {{ g.value }}</span> {{ g.losses }} losses
</div>
<h3 style="margin-top:20px">Top loss personas</h3>
<div v-if="!insight.top_loss_personas || !insight.top_loss_personas.length" class="card muted">No losses yet 🎉</div>
<div class="card" v-for="(p, i) in insight.top_loss_personas" :key="i" style="margin-bottom:8px">
<strong>{{ p.persona_name }}</strong> score {{ p.score }}<br />
<span class="muted">{{ p.why }}</span>
</div>
</div>
</template>
<script setup>
import { onMounted, ref } from 'vue'
import { api } from '../api'
import { i18n } from '../i18n'
const insight = ref({ wins: 0, losses: 0, total_sessions: 0, by_tier: [], top_loss_personas: [] })
onMounted(async () => { insight.value = (await api.weakAreas()).insight })
</script>
<style scoped>
.stat { text-align: center; min-width: 100px; }
.stat div { color: var(--muted); font-size: 12px; }
.stat strong { font-size: 22px; }
</style>