fix(admin): correct ticket message bubble alignment in admin panel
This commit is contained in:
1 parent
3cb4bcf64a
commit
42f9eda8aa
6 files changed
+245
-5
No files matched your search
@@ -17,7 +17,7 @@ class MessageResource extends JsonResource
|
||||
return [
|
||||
"id" => $this['id'],
|
||||
"ticket_id" => $this['ticket_id'],
|
||||
"is_me" => $this['is_me'],
|
||||
"is_me" => $this['is_from_user'],
|
||||
"message" => $this["message"],
|
||||
"created_at" => $this['created_at'],
|
||||
"updated_at" => $this['updated_at']
|
||||
|
||||
@@ -15,7 +15,8 @@ use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
* @property \Illuminate\Support\Carbon $created_at
|
||||
* @property \Illuminate\Support\Carbon $updated_at
|
||||
* @property-read \App\Models\Ticket $ticket 关联的工单
|
||||
* @property-read bool $is_me 当前消息是否由工单发起人发送
|
||||
* @property-read bool $is_from_user 消息是否由工单发起人发送
|
||||
* @property-read bool $is_from_admin 消息是否由管理员发送
|
||||
*/
|
||||
class TicketMessage extends Model
|
||||
{
|
||||
@@ -27,7 +28,7 @@ class TicketMessage extends Model
|
||||
'updated_at' => 'timestamp'
|
||||
];
|
||||
|
||||
protected $appends = ['is_me'];
|
||||
protected $appends = ['is_from_user', 'is_from_admin'];
|
||||
|
||||
/**
|
||||
* 关联的工单
|
||||
@@ -40,8 +41,16 @@ class TicketMessage extends Model
|
||||
/**
|
||||
* 判断消息是否由工单发起人发送
|
||||
*/
|
||||
public function getIsMeAttribute(): bool
|
||||
public function getIsFromUserAttribute(): bool
|
||||
{
|
||||
return $this->ticket->user_id === $this->user_id;
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断消息是否由管理员发送
|
||||
*/
|
||||
public function getIsFromAdminAttribute(): bool
|
||||
{
|
||||
return $this->ticket->user_id !== $this->user_id;
|
||||
}
|
||||
}
|
||||
Vendored
+1
-1
@@ -6,4 +6,4 @@ import{r as u,j as e,t as Sl,c as kl,I as Ka,a as As,S as Na,u as Ts,b as Tl,d a
|
||||
`+a("columns.online_status.offline_duration.days",{count:_}):h>0?o+=`
|
||||
`+a("columns.online_status.offline_duration.hours",{count:h}):c>0?o+=`
|
||||
`+a("columns.online_status.offline_duration.minutes",{count:c}):o+=`
|
||||
`+a("columns.online_status.offline_duration.seconds",{count:m})}return e.jsx(ve,{delayDuration:100,children:e.jsxs(he,{children:[e.jsx(pe,{children:e.jsxs("div",{className:"flex items-center gap-2.5",children:[e.jsx("div",{className:N("size-2.5 rounded-full ring-2 ring-offset-2",d?"bg-green-500 ring-green-500/20":"bg-gray-300 ring-gray-300/20","transition-all duration-300")}),e.jsx("span",{className:"font-medium text-foreground/90",children:i.original.email})]})}),e.jsx(ce,{side:"bottom",className:"max-w-[280px]",children:e.jsx("p",{className:"whitespace-pre-line text-sm",children:o})})]})})},enableSorting:!1,enableHiding:!1},{accessorKey:"online_count",header:({column:i})=>e.jsx(O,{column:i,title:a("columns.online_count")}),cell:({row:i})=>{const l=i.original.device_limit,d=i.original.online_count||0;return e.jsx(ve,{delayDuration:100,children:e.jsxs(he,{children:[e.jsx(pe,{children:e.jsx("div",{className:"flex items-center gap-1.5",children:e.jsxs(q,{variant:"outline",className:N("min-w-[4rem] justify-center",l!==null&&d>=l?"border-destructive/50 bg-destructive/10 text-destructive":"border-primary/40 bg-primary/5 text-primary/90"),children:[d," / ",l===null?"∞":l]})})}),e.jsx(ce,{side:"bottom",children:e.jsx("p",{className:"text-sm",children:l===null?a("columns.device_limit.unlimited"):a("columns.device_limit.limited",{count:l})})})]})})},enableSorting:!0,enableHiding:!1},{accessorKey:"banned",header:({column:i})=>e.jsx(O,{column:i,title:a("columns.status")}),cell:({row:i})=>{const l=i.original.banned;return e.jsx("div",{className:"flex justify-center",children:e.jsx(q,{className:N("min-w-20 justify-center transition-colors",l?"bg-destructive/15 text-destructive hover:bg-destructive/25":"bg-success/15 text-success hover:bg-success/25"),children:a(l?"columns.status_text.banned":"columns.status_text.normal")})})},enableSorting:!0,filterFn:(i,l,d)=>d.includes(i.getValue(l))},{accessorKey:"plan_id",header:({column:i})=>e.jsx(O,{column:i,title:a("columns.subscription")}),cell:({row:i})=>e.jsx("div",{className:"min-w-[10em] break-all",children:i.original?.plan?.name||"-"}),enableSorting:!1,enableHiding:!1},{accessorKey:"group_id",header:({column:i})=>e.jsx(O,{column:i,title:a("columns.group")}),cell:({row:i})=>e.jsx("div",{className:"flex flex-wrap gap-1",children:e.jsx(q,{variant:"outline",className:N("px-2 py-0.5 font-medium","bg-secondary/50 hover:bg-secondary/70","border border-border/50","transition-all duration-200","cursor-default select-none","flex items-center gap-1.5 whitespace-nowrap"),children:i.original?.group?.name||"-"})}),enableSorting:!1},{accessorKey:"total_used",header:({column:i})=>e.jsx(O,{column:i,title:a("columns.used_traffic")}),cell:({row:i})=>{const l=ps(i.original?.total_used),d=ps(i.original?.transfer_enable),m=i.original?.total_used/i.original?.transfer_enable*100||0;return e.jsx(ve,{delayDuration:100,children:e.jsxs(he,{children:[e.jsx(pe,{className:"w-full",children:e.jsxs("div",{className:"w-full space-y-1",children:[e.jsxs("div",{className:"flex justify-between text-sm",children:[e.jsx("span",{className:"text-muted-foreground",children:l}),e.jsxs("span",{className:"text-xs text-muted-foreground",children:[m.toFixed(1),"%"]})]}),e.jsx("div",{className:"h-1.5 w-full rounded-full bg-secondary",children:e.jsx("div",{className:N("h-full rounded-full transition-all",m>90?"bg-destructive":"bg-primary"),style:{width:`${Math.min(m,100)}%`}})})]})}),e.jsx(ce,{side:"bottom",children:e.jsxs("p",{className:"text-sm",children:[a("columns.total_traffic"),": ",d]})})]})})}},{accessorKey:"transfer_enable",header:({column:i})=>e.jsx(O,{column:i,title:a("columns.total_traffic")}),cell:({row:i})=>e.jsx("div",{className:"font-medium text-muted-foreground",children:ps(i.original?.transfer_enable)})},{accessorKey:"expired_at",header:({column:i})=>e.jsx(O,{column:i,title:a("columns.expire_time")}),cell:({row:i})=>{const l=i.original.expired_at,d=Date.now()/1e3,m=l!=null&&l<d,o=l!=null?new Date(l*1e3):null,c=o!=null?Math.ceil((o.getTime()-Date.now())/(1e3*60*60*24)):null;return e.jsx(ve,{delayDuration:100,children:e.jsxs(he,{children:[e.jsx(pe,{className:"block w-full",children:e.jsx(q,{variant:"outline",className:N("w-full justify-center transition-colors",m?"border-destructive/50 bg-destructive/10 text-destructive":l?"border-success/50 bg-success/10 text-success":"border-primary/40 bg-primary/5 text-primary/90"),children:l==null?a("columns.expire_status.permanent"):we(l,"YYYY-MM-DD")})}),e.jsx(ce,{side:"bottom",className:"space-y-1 p-3",children:l!=null?e.jsxs(e.Fragment,{children:[e.jsxs("p",{className:"text-sm text-muted-foreground",children:[a("columns.expire_time"),": ",we(l)]}),e.jsx("p",{className:N("text-sm font-medium",m?"text-destructive":"text-success"),children:m?a("columns.expire_status.expired",{days:Math.abs(c??0)}):a("columns.expire_status.remaining",{days:c??0})})]}):e.jsx("p",{className:"text-sm font-medium",children:a("columns.expire_status.permanent")})})]})})}},{accessorKey:"bal
Line truncated
|
||||
`+a("columns.online_status.offline_duration.seconds",{count:m})}return e.jsx(ve,{delayDuration:100,children:e.jsxs(he,{children:[e.jsx(pe,{children:e.jsxs("div",{className:"flex items-center gap-2.5",children:[e.jsx("div",{className:N("size-2.5 rounded-full ring-2 ring-offset-2",d?"bg-green-500 ring-green-500/20":"bg-gray-300 ring-gray-300/20","transition-all duration-300")}),e.jsx("span",{className:"font-medium text-foreground/90",children:i.original.email})]})}),e.jsx(ce,{side:"bottom",className:"max-w-[280px]",children:e.jsx("p",{className:"whitespace-pre-line text-sm",children:o})})]})})},enableSorting:!1,enableHiding:!1},{accessorKey:"online_count",header:({column:i})=>e.jsx(O,{column:i,title:a("columns.online_count")}),cell:({row:i})=>{const l=i.original.device_limit,d=i.original.online_count||0;return e.jsx(ve,{delayDuration:100,children:e.jsxs(he,{children:[e.jsx(pe,{children:e.jsx("div",{className:"flex items-center gap-1.5",children:e.jsxs(q,{variant:"outline",className:N("min-w-[4rem] justify-center",l!==null&&d>=l?"border-destructive/50 bg-destructive/10 text-destructive":"border-primary/40 bg-primary/5 text-primary/90"),children:[d," / ",l===null?"∞":l]})})}),e.jsx(ce,{side:"bottom",children:e.jsx("p",{className:"text-sm",children:l===null?a("columns.device_limit.unlimited"):a("columns.device_limit.limited",{count:l})})})]})})},enableSorting:!0,enableHiding:!1},{accessorKey:"banned",header:({column:i})=>e.jsx(O,{column:i,title:a("columns.status")}),cell:({row:i})=>{const l=i.original.banned;return e.jsx("div",{className:"flex justify-center",children:e.jsx(q,{className:N("min-w-20 justify-center transition-colors",l?"bg-destructive/15 text-destructive hover:bg-destructive/25":"bg-success/15 text-success hover:bg-success/25"),children:a(l?"columns.status_text.banned":"columns.status_text.normal")})})},enableSorting:!0,filterFn:(i,l,d)=>d.includes(i.getValue(l))},{accessorKey:"plan_id",header:({column:i})=>e.jsx(O,{column:i,title:a("columns.subscription")}),cell:({row:i})=>e.jsx("div",{className:"min-w-[10em] break-all",children:i.original?.plan?.name||"-"}),enableSorting:!1,enableHiding:!1},{accessorKey:"group_id",header:({column:i})=>e.jsx(O,{column:i,title:a("columns.group")}),cell:({row:i})=>e.jsx("div",{className:"flex flex-wrap gap-1",children:e.jsx(q,{variant:"outline",className:N("px-2 py-0.5 font-medium","bg-secondary/50 hover:bg-secondary/70","border border-border/50","transition-all duration-200","cursor-default select-none","flex items-center gap-1.5 whitespace-nowrap"),children:i.original?.group?.name||"-"})}),enableSorting:!1},{accessorKey:"total_used",header:({column:i})=>e.jsx(O,{column:i,title:a("columns.used_traffic")}),cell:({row:i})=>{const l=ps(i.original?.total_used),d=ps(i.original?.transfer_enable),m=i.original?.total_used/i.original?.transfer_enable*100||0;return e.jsx(ve,{delayDuration:100,children:e.jsxs(he,{children:[e.jsx(pe,{className:"w-full",children:e.jsxs("div",{className:"w-full space-y-1",children:[e.jsxs("div",{className:"flex justify-between text-sm",children:[e.jsx("span",{className:"text-muted-foreground",children:l}),e.jsxs("span",{className:"text-xs text-muted-foreground",children:[m.toFixed(1),"%"]})]}),e.jsx("div",{className:"h-1.5 w-full rounded-full bg-secondary",children:e.jsx("div",{className:N("h-full rounded-full transition-all",m>90?"bg-destructive":"bg-primary"),style:{width:`${Math.min(m,100)}%`}})})]})}),e.jsx(ce,{side:"bottom",children:e.jsxs("p",{className:"text-sm",children:[a("columns.total_traffic"),": ",d]})})]})})}},{accessorKey:"transfer_enable",header:({column:i})=>e.jsx(O,{column:i,title:a("columns.total_traffic")}),cell:({row:i})=>e.jsx("div",{className:"font-medium text-muted-foreground",children:ps(i.original?.transfer_enable)})},{accessorKey:"expired_at",header:({column:i})=>e.jsx(O,{column:i,title:a("columns.expire_time")}),cell:({row:i})=>{const l=i.original.expired_at,d=Date.now()/1e3,m=l!=null&&l<d,o=l!=null?new Date(l*1e3):null,c=o!=null?Math.ceil((o.getTime()-Date.now())/(1e3*60*60*24)):null;return e.jsx(ve,{delayDuration:100,children:e.jsxs(he,{children:[e.jsx(pe,{className:"block w-full",children:e.jsx(q,{variant:"outline",className:N("w-full justify-center transition-colors",m?"border-destructive/50 bg-destructive/10 text-destructive":l?"border-success/50 bg-success/10 text-success":"border-primary/40 bg-primary/5 text-primary/90"),children:l==null?a("columns.expire_status.permanent"):we(l,"YYYY-MM-DD")})}),e.jsx(ce,{side:"bottom",className:"space-y-1 p-3",children:l!=null?e.jsxs(e.Fragment,{children:[e.jsxs("p",{className:"text-sm text-muted-foreground",children:[a("columns.expire_time"),": ",we(l)]}),e.jsx("p",{className:N("text-sm font-medium",m?"text-destructive":"text-success"),children:m?a("columns.expire_status.expired",{days:Math.abs(c??0)}):a("columns.expire_status.remaining",{days:c??0})})]}):e.jsx("p",{className:"text-sm font-medium",children:a("columns.expire_status.permanent")})})]})})}},{accessorKey:"bal
Line truncated
|
||||
Vendored
+77
@@ -1772,6 +1772,83 @@ window.XBOARD_TRANSLATIONS['en-US'] = {
|
||||
"empty": "No ALPN Protocols Available"
|
||||
}
|
||||
}
|
||||
},
|
||||
"socks": {
|
||||
"version": {
|
||||
"label": "Protocol Version",
|
||||
"placeholder": "Select SOCKS Version"
|
||||
},
|
||||
"tls": {
|
||||
"label": "TLS",
|
||||
"placeholder": "Please select security",
|
||||
"disabled": "Disabled",
|
||||
"enabled": "Enabled"
|
||||
},
|
||||
"tls_settings": {
|
||||
"server_name": {
|
||||
"label": "Server Name Indication (SNI)",
|
||||
"placeholder": "Leave empty if not used"
|
||||
},
|
||||
"allow_insecure": "Allow Insecure?"
|
||||
},
|
||||
"network": {
|
||||
"label": "Transport Protocol",
|
||||
"placeholder": "Select transport protocol"
|
||||
}
|
||||
},
|
||||
"naive": {
|
||||
"tls_settings": {
|
||||
"server_name": {
|
||||
"label": "Server Name Indication (SNI)",
|
||||
"placeholder": "Used for certificate verification when domain differs from node address"
|
||||
},
|
||||
"allow_insecure": "Allow Insecure"
|
||||
},
|
||||
"tls": {
|
||||
"label": "TLS",
|
||||
"placeholder": "Please select security",
|
||||
"disabled": "Disabled",
|
||||
"enabled": "Enabled",
|
||||
"server_name": {
|
||||
"label": "Server Name Indication (SNI)",
|
||||
"placeholder": "Used for certificate verification when domain differs from node address"
|
||||
},
|
||||
"allow_insecure": "Allow Insecure"
|
||||
}
|
||||
},
|
||||
"http": {
|
||||
"tls_settings": {
|
||||
"server_name": {
|
||||
"label": "Server Name Indication (SNI)",
|
||||
"placeholder": "Used for certificate verification when domain differs from node address"
|
||||
},
|
||||
"allow_insecure": "Allow Insecure"
|
||||
},
|
||||
"tls": {
|
||||
"label": "TLS",
|
||||
"placeholder": "Please select security",
|
||||
"disabled": "Disabled",
|
||||
"enabled": "Enabled",
|
||||
"server_name": {
|
||||
"label": "Server Name Indication (SNI)",
|
||||
"placeholder": "Used for certificate verification when domain differs from node address"
|
||||
},
|
||||
"allow_insecure": "Allow Insecure"
|
||||
}
|
||||
},
|
||||
"mieru": {
|
||||
"transport": {
|
||||
"label": "Transport Protocol",
|
||||
"placeholder": "Select transport protocol"
|
||||
},
|
||||
"multiplexing": {
|
||||
"label": "Multiplexing",
|
||||
"placeholder": "Select multiplexing level",
|
||||
"MULTIPLEXING_OFF": "Disabled",
|
||||
"MULTIPLEXING_LOW": "Low",
|
||||
"MULTIPLEXING_MIDDLE": "Medium",
|
||||
"MULTIPLEXING_HIGH": "High"
|
||||
}
|
||||
}
|
||||
},
|
||||
"network_settings": {
|
||||
|
||||
Vendored
+77
@@ -1740,6 +1740,83 @@ window.XBOARD_TRANSLATIONS['ko-KR'] = {
|
||||
"empty": "사용 가능한 ALPN 프로토콜이 없습니다"
|
||||
}
|
||||
}
|
||||
},
|
||||
"socks": {
|
||||
"version": {
|
||||
"label": "프로토콜 버전",
|
||||
"placeholder": "SOCKS 버전 선택"
|
||||
},
|
||||
"tls": {
|
||||
"label": "TLS",
|
||||
"placeholder": "보안을 선택해주세요",
|
||||
"disabled": "비활성화",
|
||||
"enabled": "활성화"
|
||||
},
|
||||
"tls_settings": {
|
||||
"server_name": {
|
||||
"label": "서버 이름 표시(SNI)",
|
||||
"placeholder": "사용하지 않는 경우 비워두세요"
|
||||
},
|
||||
"allow_insecure": "안전하지 않은 연결 허용?"
|
||||
},
|
||||
"network": {
|
||||
"label": "전송 프로토콜",
|
||||
"placeholder": "전송 프로토콜 선택"
|
||||
}
|
||||
},
|
||||
"naive": {
|
||||
"tls_settings": {
|
||||
"server_name": {
|
||||
"label": "서버 이름 표시(SNI)",
|
||||
"placeholder": "사용하지 않는 경우 비워두세요"
|
||||
},
|
||||
"allow_insecure": "안전하지 않은 연결 허용?"
|
||||
},
|
||||
"tls": {
|
||||
"label": "TLS",
|
||||
"placeholder": "보안을 선택해주세요",
|
||||
"disabled": "비활성화",
|
||||
"enabled": "활성화",
|
||||
"server_name": {
|
||||
"label": "서버 이름 표시(SNI)",
|
||||
"placeholder": "노드 주소와 인증서가 다를 때 인증서 확인에 사용"
|
||||
},
|
||||
"allow_insecure": "안전하지 않은 연결 허용"
|
||||
}
|
||||
},
|
||||
"http": {
|
||||
"tls_settings": {
|
||||
"server_name": {
|
||||
"label": "서버 이름 표시(SNI)",
|
||||
"placeholder": "사용하지 않는 경우 비워두세요"
|
||||
},
|
||||
"allow_insecure": "안전하지 않은 연결 허용?"
|
||||
},
|
||||
"tls": {
|
||||
"label": "TLS",
|
||||
"placeholder": "보안을 선택해주세요",
|
||||
"disabled": "비활성화",
|
||||
"enabled": "활성화",
|
||||
"server_name": {
|
||||
"label": "서버 이름 표시(SNI)",
|
||||
"placeholder": "노드 주소와 인증서가 다를 때 인증서 확인에 사용"
|
||||
},
|
||||
"allow_insecure": "안전하지 않은 연결 허용"
|
||||
}
|
||||
},
|
||||
"mieru": {
|
||||
"transport": {
|
||||
"label": "전송 프로토콜",
|
||||
"placeholder": "전송 프로토콜 선택"
|
||||
},
|
||||
"multiplexing": {
|
||||
"label": "다중화",
|
||||
"placeholder": "다중화 수준 선택",
|
||||
"MULTIPLEXING_OFF": "비활성화",
|
||||
"MULTIPLEXING_LOW": "낮음",
|
||||
"MULTIPLEXING_MIDDLE": "중간",
|
||||
"MULTIPLEXING_HIGH": "높음"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
Vendored
+77
@@ -1739,6 +1739,83 @@ window.XBOARD_TRANSLATIONS['zh-CN'] = {
|
||||
"empty": "未找到可用的ALPN协议"
|
||||
}
|
||||
}
|
||||
},
|
||||
"socks": {
|
||||
"version": {
|
||||
"label": "协议版本",
|
||||
"placeholder": "选择SOCKS版本"
|
||||
},
|
||||
"tls": {
|
||||
"label": "TLS",
|
||||
"placeholder": "请选择安全性",
|
||||
"disabled": "不支持",
|
||||
"enabled": "支持"
|
||||
},
|
||||
"tls_settings": {
|
||||
"server_name": {
|
||||
"label": "服务器名称指示(SNI)",
|
||||
"placeholder": "不使用请留空"
|
||||
},
|
||||
"allow_insecure": "允许不安全?"
|
||||
},
|
||||
"network": {
|
||||
"label": "传输协议",
|
||||
"placeholder": "选择传输协议"
|
||||
}
|
||||
},
|
||||
"naive": {
|
||||
"tls_settings": {
|
||||
"server_name": {
|
||||
"label": "服务器名称指示(SNI)",
|
||||
"placeholder": "不使用请留空"
|
||||
},
|
||||
"allow_insecure": "允许不安全?"
|
||||
},
|
||||
"tls": {
|
||||
"label": "TLS",
|
||||
"placeholder": "请选择安全性",
|
||||
"disabled": "不支持",
|
||||
"enabled": "支持",
|
||||
"server_name": {
|
||||
"label": "服务器名称指示(SNI)",
|
||||
"placeholder": "当节点地址与证书不一致时用于证书验证"
|
||||
},
|
||||
"allow_insecure": "允许不安全连接"
|
||||
}
|
||||
},
|
||||
"http": {
|
||||
"tls": {
|
||||
"label": "TLS",
|
||||
"placeholder": "请选择安全性",
|
||||
"disabled": "不支持",
|
||||
"enabled": "支持",
|
||||
"server_name": {
|
||||
"label": "服务器名称指示(SNI)",
|
||||
"placeholder": "当节点地址与证书不一致时用于证书验证"
|
||||
},
|
||||
"allow_insecure": "允许不安全连接"
|
||||
},
|
||||
"tls_settings": {
|
||||
"server_name": {
|
||||
"label": "服务器名称指示(SNI)",
|
||||
"placeholder": "当节点地址与证书不一致时用于证书验证"
|
||||
},
|
||||
"allow_insecure": "允许不安全连接"
|
||||
}
|
||||
},
|
||||
"mieru": {
|
||||
"transport": {
|
||||
"label": "传输协议",
|
||||
"placeholder": "选择传输协议"
|
||||
},
|
||||
"multiplexing": {
|
||||
"label": "多路复用",
|
||||
"placeholder": "选择多路复用级别",
|
||||
"MULTIPLEXING_OFF": "关闭",
|
||||
"MULTIPLEXING_LOW": "低",
|
||||
"MULTIPLEXING_MIDDLE": "中",
|
||||
"MULTIPLEXING_HIGH": "高"
|
||||
}
|
||||
}
|
||||
},
|
||||
"network_settings": {
|
||||
|
||||
Reference in new issue
Block a user