Spaces:
3SCError404
/
Paused

dushyantsingh0 commited on
Commit
d7002bc
·
1 Parent(s): e92344c

backend stabilization

Browse files
api/v1/tickets.py CHANGED
@@ -835,7 +835,7 @@ async def get_ticket(
835
  stmt = stmt.where(Ticket.workspace_id == current_user.workspace_id)
836
 
837
  result = await db.execute(stmt)
838
- ticket = result.scalar_one_or_none()
839
  if not ticket:
840
  raise HTTPException(status_code=404, detail="Ticket not found or access denied")
841
 
@@ -1233,7 +1233,7 @@ async def escalate_ticket(
1233
  if current_user.role != UserRole.SC_ADMIN:
1234
  esc_stmt = esc_stmt.where(Ticket.workspace_id == current_user.workspace_id)
1235
  result = await db.execute(esc_stmt)
1236
- ticket = result.scalar_one_or_none()
1237
 
1238
  if not ticket:
1239
  raise HTTPException(status_code=404, detail="Ticket not found")
 
835
  stmt = stmt.where(Ticket.workspace_id == current_user.workspace_id)
836
 
837
  result = await db.execute(stmt)
838
+ ticket = result.unique().scalar_one_or_none()
839
  if not ticket:
840
  raise HTTPException(status_code=404, detail="Ticket not found or access denied")
841
 
 
1233
  if current_user.role != UserRole.SC_ADMIN:
1234
  esc_stmt = esc_stmt.where(Ticket.workspace_id == current_user.workspace_id)
1235
  result = await db.execute(esc_stmt)
1236
+ ticket = result.unique().scalar_one_or_none()
1237
 
1238
  if not ticket:
1239
  raise HTTPException(status_code=404, detail="Ticket not found")
frontend/apps/customer/src/components/KanbanView.tsx CHANGED
@@ -1,6 +1,6 @@
1
  import React from 'react';
2
  import { motion, AnimatePresence } from 'framer-motion';
3
- import { PriorityBadge } from './Badges';
4
 
5
  interface KanbanViewProps {
6
  tickets: any[];
@@ -105,44 +105,64 @@ export const KanbanView: React.FC<KanbanViewProps> = ({ tickets, onSelect, loadi
105
  style={{
106
  background: "#fff",
107
  borderRadius: 12,
108
- padding: 16,
109
  border: `1px solid ${COLORS.border}`,
110
- boxShadow: "0 2px 4px rgba(0,0,0,0.02)",
 
111
  cursor: "pointer",
 
 
 
 
112
  position: 'relative',
113
- overflow: 'hidden'
 
114
  }}
115
  onMouseEnter={e => {
116
  e.currentTarget.style.borderColor = COLORS.brand;
117
- e.currentTarget.style.boxShadow = "0 4px 12px rgba(99, 102, 241, 0.08)";
 
118
  }}
119
  onMouseLeave={e => {
120
  e.currentTarget.style.borderColor = COLORS.border;
121
- e.currentTarget.style.boxShadow = "0 2px 4px rgba(0,0,0,0.02)";
 
122
  }}
123
  >
124
  <div style={{
125
  display: "flex",
126
  justifyContent: "space-between",
127
- alignItems: "flex-start",
128
- marginBottom: 12
129
  }}>
130
  <span style={{
131
  fontSize: 10,
132
  fontWeight: 900,
133
  color: COLORS.brand,
134
- fontFamily: 'monospace'
 
135
  }}>#{t.id.slice(0, 8).toUpperCase()}</span>
136
  <PriorityBadge priority={t.priority} />
137
  </div>
138
-
139
- <div style={{
140
- fontSize: 13,
141
- fontWeight: 700,
142
- color: COLORS.text,
143
- marginBottom: 8,
144
- lineHeight: 1.4
145
- }}>{t.title}</div>
 
 
 
 
 
 
 
 
 
 
 
 
146
 
147
  <div style={{
148
  display: "flex",
@@ -150,15 +170,13 @@ export const KanbanView: React.FC<KanbanViewProps> = ({ tickets, onSelect, loadi
150
  alignItems: "center",
151
  marginTop: "auto",
152
  paddingTop: 12,
153
- borderTop: `1px solid rgba(0,0,0,0.03)`
154
  }}>
155
- <div style={{ fontSize: 11, color: COLORS.muted, fontWeight: 600 }}>
156
- {t.category || 'Support'}
157
- </div>
158
  <div style={{
159
  fontSize: 10,
160
  color: COLORS.muted,
161
- fontWeight: 500
162
  }}>
163
  {new Date(t.updated_at).toLocaleDateString([], { month: 'short', day: 'numeric' })}
164
  </div>
 
1
  import React from 'react';
2
  import { motion, AnimatePresence } from 'framer-motion';
3
+ import { PriorityBadge, StatusBadge, statusConfig } from './Badges';
4
 
5
  interface KanbanViewProps {
6
  tickets: any[];
 
105
  style={{
106
  background: "#fff",
107
  borderRadius: 12,
108
+ padding: "16px 20px",
109
  border: `1px solid ${COLORS.border}`,
110
+ borderLeft: `4px solid ${statusConfig[(t.status || 'OPEN').toUpperCase()]?.dot || COLORS.brand}`,
111
+ boxShadow: "0 4px 12px rgba(0,0,0,0.03)",
112
  cursor: "pointer",
113
+ display: "grid",
114
+ gridTemplateRows: "auto 1fr auto",
115
+ gap: 12,
116
+ minHeight: "135px",
117
  position: 'relative',
118
+ overflow: 'hidden',
119
+ transition: 'all 0.2s cubic-bezier(0.16, 1, 0.3, 1)'
120
  }}
121
  onMouseEnter={e => {
122
  e.currentTarget.style.borderColor = COLORS.brand;
123
+ e.currentTarget.style.transform = "translateY(-2px)";
124
+ e.currentTarget.style.boxShadow = "0 8px 24px rgba(99, 102, 241, 0.12)";
125
  }}
126
  onMouseLeave={e => {
127
  e.currentTarget.style.borderColor = COLORS.border;
128
+ e.currentTarget.style.transform = "translateY(0)";
129
+ e.currentTarget.style.boxShadow = "0 4px 12px rgba(0,0,0,0.03)";
130
  }}
131
  >
132
  <div style={{
133
  display: "flex",
134
  justifyContent: "space-between",
135
+ alignItems: "center"
 
136
  }}>
137
  <span style={{
138
  fontSize: 10,
139
  fontWeight: 900,
140
  color: COLORS.brand,
141
+ fontFamily: 'monospace',
142
+ letterSpacing: '0.05em'
143
  }}>#{t.id.slice(0, 8).toUpperCase()}</span>
144
  <PriorityBadge priority={t.priority} />
145
  </div>
146
+
147
+ <div style={{
148
+ display: "flex",
149
+ flexDirection: "column",
150
+ gap: 8
151
+ }}>
152
+ <div style={{
153
+ fontSize: 14,
154
+ fontWeight: 700,
155
+ color: COLORS.text,
156
+ lineHeight: 1.35,
157
+ display: '-webkit-box',
158
+ WebkitLineClamp: 2,
159
+ WebkitBoxOrient: 'vertical',
160
+ overflow: 'hidden'
161
+ }}>{t.title}</div>
162
+ <div style={{ fontSize: 11, color: COLORS.muted, fontWeight: 600 }}>
163
+ {t.category || 'System Support'}
164
+ </div>
165
+ </div>
166
 
167
  <div style={{
168
  display: "flex",
 
170
  alignItems: "center",
171
  marginTop: "auto",
172
  paddingTop: 12,
173
+ borderTop: `1px solid rgba(0,0,0,0.04)`
174
  }}>
175
+ <StatusBadge status={t.status || 'OPEN'} />
 
 
176
  <div style={{
177
  fontSize: 10,
178
  color: COLORS.muted,
179
+ fontWeight: 600
180
  }}>
181
  {new Date(t.updated_at).toLocaleDateString([], { month: 'short', day: 'numeric' })}
182
  </div>
frontend/apps/customer/src/components/TicketList.tsx CHANGED
@@ -164,11 +164,13 @@ export const TicketList: React.FC<TicketListProps> = ({ setActive, setSelectedTi
164
  {/* Main List Section (75%) */}
165
  <div style={{ flex: "1 1 600px", minWidth: 0 }}>
166
  {displayMode === "KANBAN" && viewMode === "MINE" ? (
167
- <KanbanView
168
- tickets={displayTickets}
169
- onSelect={(t) => { setSelectedTicket(t); setActive("thread"); }}
170
- loading={loading}
171
- />
 
 
172
  ) : (
173
  <div style={{ background: COLORS.card, border: `1px solid ${COLORS.border}`, borderRadius: 12, overflow: "hidden", boxShadow: "0 1px 3px rgba(0,0,0,0.1)" }}>
174
  {loading && tickets.length === 0 ? (
 
164
  {/* Main List Section (75%) */}
165
  <div style={{ flex: "1 1 600px", minWidth: 0 }}>
166
  {displayMode === "KANBAN" && viewMode === "MINE" ? (
167
+ <div style={{ width: '100%', overflowX: 'auto', paddingBottom: 10 }}>
168
+ <KanbanView
169
+ tickets={displayTickets}
170
+ onSelect={(t) => { setSelectedTicket(t); setActive("thread"); }}
171
+ loading={loading}
172
+ />
173
+ </div>
174
  ) : (
175
  <div style={{ background: COLORS.card, border: `1px solid ${COLORS.border}`, borderRadius: 12, overflow: "hidden", boxShadow: "0 1px 3px rgba(0,0,0,0.1)" }}>
176
  {loading && tickets.length === 0 ? (