@shiva004/surveys 0.1.2 → 0.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +109 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +403 -0
- package/dist/index.js +8716 -0
- package/dist/index.js.map +1 -0
- package/dist/style.css +1 -0
- package/package.json +33 -27
- package/src/Pages/Allsurvey/Allsurvey.tsx +0 -157
- package/src/Pages/Allsurvey/SurveyGridCard.tsx +0 -124
- package/src/Pages/Allsurvey/index.ts +0 -1
- package/src/Pages/Allsurvey/surveysTable.config.ts +0 -15
- package/src/Pages/Createsurvey/Createsurvey.tsx +0 -318
- package/src/Pages/Createsurvey/index.ts +0 -1
- package/src/Pages/NPStracker/NPStracker.tsx +0 -78
- package/src/Pages/NPStracker/index.ts +0 -1
- package/src/Pages/Responses/Responses.tsx +0 -61
- package/src/Pages/Responses/index.ts +0 -1
- package/src/Pages/Responses/responsesTable.config.ts +0 -74
- package/src/Pages/Surveyanalytics/Surveyanalytics.tsx +0 -154
- package/src/Pages/Surveyanalytics/analyticsTable.config.ts +0 -123
- package/src/Pages/Surveyanalytics/index.ts +0 -1
- package/src/Pages/Surveydetails/Surveydetails.tsx +0 -202
- package/src/Pages/Surveydetails/index.ts +0 -1
- package/src/Pages/Surveytemplates/Surveytemplates.tsx +0 -299
- package/src/Pages/Surveytemplates/index.ts +0 -1
- package/src/Pages/surveyPage.module.scss +0 -49
- package/src/cells/SurveyCells.tsx +0 -370
- package/src/hooks/useSurveyResponses.ts +0 -37
- package/src/hooks/useTableConfig.ts +0 -77
- package/src/hooks/useTableData.ts +0 -184
- package/src/index.ts +0 -24
- package/src/nav.ts +0 -55
- package/src/routes.ts +0 -98
- package/src/services/api/TableConfigDto.ts +0 -36
- package/src/services/api/TableQueryParams.ts +0 -10
- package/src/services/api/surveys.api.ts +0 -144
- package/src/services/api/types.ts +0 -113
- package/src/types/survey.types.ts +0 -175
package/dist/style.css
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
._wrapper_80t4i_2{display:flex;flex-direction:column;gap:16px;padding:20px;min-width:0}._statsgrid_80t4i_2{display:grid;gap:16px;grid-template-columns:repeat(auto-fit,minmax(210px,1fr))}._cards_80t4i_18{display:grid;gap:16px;grid-template-columns:repeat(auto-fill,minmax(320px,1fr))}._stack_80t4i_24{display:flex;flex-direction:column;gap:16px}._split_80t4i_31{display:flex;align-items:flex-start;gap:20px}._main_80t4i_37{flex:1;min-width:0}._detail_80t4i_42{display:none;width:320px;flex-shrink:0;align-self:flex-start}@media(min-width:1280px){._detail_80t4i_42{display:block}}
|
package/package.json
CHANGED
|
@@ -1,47 +1,53 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shiva004/surveys",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"description": "Survey module: all surveys, templates, create, details, responses, NPS tracker and analytics pages, with routes, nav, hooks and API client.",
|
|
3
|
+
"version": "0.1.5",
|
|
5
4
|
"type": "module",
|
|
6
|
-
"
|
|
7
|
-
|
|
5
|
+
"files": [
|
|
6
|
+
"dist"
|
|
7
|
+
],
|
|
8
|
+
"main": "./dist/index.cjs",
|
|
9
|
+
"module": "./dist/index.js",
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"sideEffects": [
|
|
12
|
+
"**/*.css"
|
|
13
|
+
],
|
|
8
14
|
"exports": {
|
|
9
|
-
".":
|
|
10
|
-
|
|
11
|
-
|
|
15
|
+
".": {
|
|
16
|
+
"types": "./dist/index.d.ts",
|
|
17
|
+
"import": "./dist/index.js",
|
|
18
|
+
"require": "./dist/index.cjs"
|
|
19
|
+
},
|
|
20
|
+
"./style.css": "./dist/style.css",
|
|
12
21
|
"./package.json": "./package.json"
|
|
13
22
|
},
|
|
14
|
-
"sideEffects": [
|
|
15
|
-
"**/*.scss"
|
|
16
|
-
],
|
|
17
|
-
"files": [
|
|
18
|
-
"src",
|
|
19
|
-
"README.md"
|
|
20
|
-
],
|
|
21
23
|
"scripts": {
|
|
22
|
-
"dev": "
|
|
24
|
+
"dev": "vite build --watch",
|
|
23
25
|
"typecheck": "tsc --noEmit",
|
|
24
|
-
"
|
|
26
|
+
"build": "vite build",
|
|
27
|
+
"prepublishOnly": "npm run typecheck && npm run build"
|
|
25
28
|
},
|
|
26
29
|
"peerDependencies": {
|
|
27
30
|
"@tanstack/react-query": ">=5",
|
|
28
31
|
"axios": ">=1",
|
|
32
|
+
"lucide-react": ">=0.300",
|
|
29
33
|
"react": ">=18",
|
|
30
34
|
"react-dom": ">=18",
|
|
31
35
|
"react-router-dom": ">=6"
|
|
32
36
|
},
|
|
33
37
|
"devDependencies": {
|
|
34
|
-
"@tanstack/react-query": "^5.
|
|
35
|
-
"@types/
|
|
36
|
-
"@types/react
|
|
37
|
-
"
|
|
38
|
+
"@tanstack/react-query": "^5.106.1",
|
|
39
|
+
"@types/node": "^22.20.5",
|
|
40
|
+
"@types/react": "^18.3.31",
|
|
41
|
+
"@types/react-dom": "^18.3.7",
|
|
42
|
+
"@vitejs/plugin-react": "^4.7.0",
|
|
43
|
+
"axios": "^1.21.0",
|
|
44
|
+
"lucide-react": "^1.70.0",
|
|
38
45
|
"react": "^18.3.1",
|
|
39
46
|
"react-dom": "^18.3.1",
|
|
40
|
-
"react-router-dom": "^
|
|
41
|
-
"
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
"
|
|
45
|
-
}
|
|
46
|
-
"license": "MIT"
|
|
47
|
+
"react-router-dom": "^6.30.6",
|
|
48
|
+
"sass": "^1.108.0",
|
|
49
|
+
"typescript": "^5.9.3",
|
|
50
|
+
"vite": "^6.4.5",
|
|
51
|
+
"vite-plugin-dts": "^4.5.4"
|
|
52
|
+
}
|
|
47
53
|
}
|
|
@@ -1,157 +0,0 @@
|
|
|
1
|
-
// src/modules/survey/Pages/Allsurvey/Allsurvey.tsx
|
|
2
|
-
import StatCard from '@/modules/DashBoard/Component/StatCard/StatCard';
|
|
3
|
-
import { DataTable } from '@/shared/components/DataTable';
|
|
4
|
-
import type { ColumnDef, RowId } from '@/shared/components/DataTable/types';
|
|
5
|
-
import { ConfirmModal } from '@/shared/components/feedback/ConfirmModal';
|
|
6
|
-
import { Header } from '@/shared/components/layout/Header';
|
|
7
|
-
import React, { useCallback, useMemo, useState } from 'react';
|
|
8
|
-
import { useNavigate } from 'react-router-dom';
|
|
9
|
-
import { useTableConfig } from '../../hooks/useTableConfig';
|
|
10
|
-
import { useTableData } from '../../hooks/useTableData';
|
|
11
|
-
import { surveysApi } from '../../services/api/surveys.api';
|
|
12
|
-
import type { SurveyRow } from '../../types/survey.types';
|
|
13
|
-
import styles from '../surveyPage.module.scss';
|
|
14
|
-
import { SurveyGridCard } from './SurveyGridCard';
|
|
15
|
-
import { surveysColumns } from './surveysTable.config';
|
|
16
|
-
|
|
17
|
-
/** Renders the all surveys component. */
|
|
18
|
-
export const AllSurveys: React.FC = () => {
|
|
19
|
-
const navigate = useNavigate();
|
|
20
|
-
const tableConfig = useTableConfig<SurveyRow>('surveys');
|
|
21
|
-
|
|
22
|
-
const {
|
|
23
|
-
items: rawItems,
|
|
24
|
-
totalCount,
|
|
25
|
-
hasMore,
|
|
26
|
-
isLoading,
|
|
27
|
-
loadMore,
|
|
28
|
-
handleSort,
|
|
29
|
-
handleTabChange,
|
|
30
|
-
sortBy,
|
|
31
|
-
sortOrder,
|
|
32
|
-
activeTab,
|
|
33
|
-
optimisticRemove,
|
|
34
|
-
} = useTableData<SurveyRow>({
|
|
35
|
-
resource: '/surveys',
|
|
36
|
-
queryKey: ['surveys'],
|
|
37
|
-
fetchFn: (params) => surveysApi.list(params),
|
|
38
|
-
pageSize: tableConfig.defaultPageSize,
|
|
39
|
-
defaultSortBy: tableConfig.defaultSortBy,
|
|
40
|
-
defaultSortOrder: tableConfig.defaultSortOrder,
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
// guard against undefined rows / missing id
|
|
44
|
-
const rows = useMemo(() => (rawItems ?? []).filter((i): i is SurveyRow => Boolean(i?.id)), [rawItems]);
|
|
45
|
-
|
|
46
|
-
const [selectedIds, setSelectedIds] = useState<Set<RowId>>(new Set());
|
|
47
|
-
const [deleteTarget, setDeleteTarget] = useState<SurveyRow | null>(null);
|
|
48
|
-
const [isDeleting, setIsDeleting] = useState(false);
|
|
49
|
-
|
|
50
|
-
const handleDelete = useCallback(async () => {
|
|
51
|
-
if (!deleteTarget) return;
|
|
52
|
-
setIsDeleting(true);
|
|
53
|
-
try {
|
|
54
|
-
await surveysApi.delete(deleteTarget.id);
|
|
55
|
-
optimisticRemove(deleteTarget.id);
|
|
56
|
-
setDeleteTarget(null);
|
|
57
|
-
} finally {
|
|
58
|
-
setIsDeleting(false);
|
|
59
|
-
}
|
|
60
|
-
}, [deleteTarget, optimisticRemove]);
|
|
61
|
-
|
|
62
|
-
const goCreate = useCallback(() => navigate('/app/all-surveys/create-survey'), [navigate]);
|
|
63
|
-
|
|
64
|
-
const controls = useMemo(
|
|
65
|
-
() =>
|
|
66
|
-
(tableConfig.controls ?? []).map((c) => ({
|
|
67
|
-
...c,
|
|
68
|
-
onClick: () => {
|
|
69
|
-
if (c.action === 'create') goCreate();
|
|
70
|
-
},
|
|
71
|
-
})),
|
|
72
|
-
[tableConfig.controls, goCreate]
|
|
73
|
-
);
|
|
74
|
-
|
|
75
|
-
// server config wins; typed fallback until it loads
|
|
76
|
-
const columns = (
|
|
77
|
-
tableConfig.columns?.length ? tableConfig.columns : surveysColumns
|
|
78
|
-
) as ColumnDef<SurveyRow>[];
|
|
79
|
-
|
|
80
|
-
/* ── stats (derived from loaded rows) ── */
|
|
81
|
-
const stats = useMemo(() => {
|
|
82
|
-
const active = rows.filter((r) => r.status === 'active').length;
|
|
83
|
-
const totalResp = rows.reduce((a, r) => a + (r.responses ?? 0), 0);
|
|
84
|
-
const scored = rows.filter((r) => r.npsScore !== null && r.npsScore !== undefined);
|
|
85
|
-
const avgNps = scored.length
|
|
86
|
-
? Math.round(scored.reduce((a, r) => a + (r.npsScore ?? 0), 0) / scored.length)
|
|
87
|
-
: null;
|
|
88
|
-
return { active, totalResp, avgNps };
|
|
89
|
-
}, [rows]);
|
|
90
|
-
|
|
91
|
-
return (
|
|
92
|
-
<div className={styles.wrapper}>
|
|
93
|
-
<Header
|
|
94
|
-
title="Surveys"
|
|
95
|
-
subtitle="Analytics · manage and track user surveys."
|
|
96
|
-
primaryText="Create Survey"
|
|
97
|
-
primaryIcon="Plus"
|
|
98
|
-
onPrimaryClick={goCreate}
|
|
99
|
-
/>
|
|
100
|
-
|
|
101
|
-
<div className={styles.statsgrid}>
|
|
102
|
-
<StatCard icon="ClipboardList" label="Total surveys" value={totalCount.toLocaleString()} trendDirection="neutral" color="#6366f1" />
|
|
103
|
-
<StatCard icon="Activity" label="Active" value={stats.active.toLocaleString()} trendDirection="neutral" color="#10b981" />
|
|
104
|
-
<StatCard icon="MessageSquare" label="Total responses" value={stats.totalResp.toLocaleString()} trendDirection="neutral" color="#7c3aed" />
|
|
105
|
-
<StatCard icon="Star" label="Avg NPS" value={stats.avgNps ?? '—'} trendDirection="neutral" color="#f59e0b" />
|
|
106
|
-
</div>
|
|
107
|
-
|
|
108
|
-
<DataTable<SurveyRow>
|
|
109
|
-
currentPage="surveys"
|
|
110
|
-
columns={columns}
|
|
111
|
-
data={rows}
|
|
112
|
-
totalCount={totalCount}
|
|
113
|
-
isLoading={tableConfig.isLoading || isLoading}
|
|
114
|
-
hasMore={hasMore}
|
|
115
|
-
onLoadMore={loadMore}
|
|
116
|
-
availableViews={['table', 'grid']}
|
|
117
|
-
renderCard={(props) => <SurveyGridCard {...props} />}
|
|
118
|
-
gridCols={{ sm: 1, md: 2, lg: 3 }}
|
|
119
|
-
tabs={tableConfig.tabs}
|
|
120
|
-
activeTab={activeTab}
|
|
121
|
-
onTabChange={handleTabChange}
|
|
122
|
-
controls={controls}
|
|
123
|
-
selectable
|
|
124
|
-
selectedIds={selectedIds}
|
|
125
|
-
onSelectionChange={setSelectedIds}
|
|
126
|
-
sortBy={sortBy}
|
|
127
|
-
sortOrder={sortOrder}
|
|
128
|
-
onSort={handleSort}
|
|
129
|
-
onEditRow={(row) => navigate(`/app/surveys/${row.id}/edit`)}
|
|
130
|
-
onActionClick={(row) => setDeleteTarget(row)}
|
|
131
|
-
rowClickBehavior={{ type: 'navigate', path: (r) => `/app/surveys/${r.id}` }}
|
|
132
|
-
height="calc(100vh - 250px)"
|
|
133
|
-
emptyMessage="No surveys found."
|
|
134
|
-
stickyHeader
|
|
135
|
-
/>
|
|
136
|
-
|
|
137
|
-
<ConfirmModal
|
|
138
|
-
open={Boolean(deleteTarget)}
|
|
139
|
-
onClose={() => setDeleteTarget(null)}
|
|
140
|
-
onConfirm={handleDelete}
|
|
141
|
-
isLoading={isDeleting}
|
|
142
|
-
title="Delete Survey"
|
|
143
|
-
description={
|
|
144
|
-
<>
|
|
145
|
-
Delete <strong className="text-white">{deleteTarget?.name}</strong> and all{' '}
|
|
146
|
-
{deleteTarget?.responses ?? 0} responses?
|
|
147
|
-
</>
|
|
148
|
-
}
|
|
149
|
-
confirmLabel="Delete Survey"
|
|
150
|
-
confirmTone="danger"
|
|
151
|
-
requireConfirmText={deleteTarget?.name}
|
|
152
|
-
/>
|
|
153
|
-
</div>
|
|
154
|
-
);
|
|
155
|
-
};
|
|
156
|
-
|
|
157
|
-
AllSurveys.displayName = 'AllSurveys';
|
|
@@ -1,124 +0,0 @@
|
|
|
1
|
-
// src/modules/survey/Pages/Allsurvey/SurveyGridCard.tsx
|
|
2
|
-
import type { RowId } from '@/shared/components/DataTable/types';
|
|
3
|
-
import { Icon } from '@/shared/components/ui/Icon/Icon';
|
|
4
|
-
import React from 'react';
|
|
5
|
-
import { Card } from '@/modules/queue/components/ui';
|
|
6
|
-
import type { SurveyListItem } from '../../types/survey.types';
|
|
7
|
-
|
|
8
|
-
/** Props for the card render component. */
|
|
9
|
-
export interface CardRenderProps<T> {
|
|
10
|
-
row: T;
|
|
11
|
-
isSelected?: boolean;
|
|
12
|
-
onSelect?: (id: RowId) => void;
|
|
13
|
-
onRowClick?: (row: T) => void;
|
|
14
|
-
rowIndex?: number;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
const SC: Record<string, { dot: string; bg: string; text: string }> = {
|
|
18
|
-
active: { dot: 'bg-[#4edea3] animate-pulse', bg: 'bg-[color:color-mix(in_srgb,var(--th-success)_10%,transparent)]', text: 'text-[color:var(--th-success)]' },
|
|
19
|
-
draft: { dot: 'bg-[#ffcc6b]', bg: 'bg-[color:color-mix(in_srgb,var(--th-warning-soft)_10%,transparent)]', text: 'text-[color:var(--th-warning-soft)]' },
|
|
20
|
-
closed: { dot: 'bg-[#958da1]', bg: 'bg-[color:color-mix(in_srgb,var(--th-ov-base)_5%,transparent)]', text: 'text-[color:var(--th-text-3)]' },
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* Renders the survey grid card component.
|
|
25
|
-
*
|
|
26
|
-
* @param props - The component props.
|
|
27
|
-
* @param props.row - The row.
|
|
28
|
-
* @param props.isSelected - The is selected.
|
|
29
|
-
* @param props.onSelect - The on select.
|
|
30
|
-
* @param props.onRowClick - The on row click.
|
|
31
|
-
*/
|
|
32
|
-
export const SurveyGridCard: React.FC<CardRenderProps<SurveyListItem>> = ({
|
|
33
|
-
row,
|
|
34
|
-
isSelected,
|
|
35
|
-
onSelect,
|
|
36
|
-
onRowClick,
|
|
37
|
-
}) => {
|
|
38
|
-
const pct = row.target > 0 ? Math.min((row.responses / row.target) * 100, 100) : 0;
|
|
39
|
-
const sc = SC[row.status] ?? SC.draft;
|
|
40
|
-
|
|
41
|
-
return (
|
|
42
|
-
<div
|
|
43
|
-
role="button"
|
|
44
|
-
tabIndex={0}
|
|
45
|
-
className="h-full cursor-pointer"
|
|
46
|
-
onClick={() => onRowClick?.(row)}
|
|
47
|
-
onKeyDown={(e) => e.key === 'Enter' && onRowClick?.(row)}
|
|
48
|
-
>
|
|
49
|
-
<Card
|
|
50
|
-
className={`group relative p-5 transition-all hover:border-[#7c3aed]/20 ${isSelected ? 'border-[#7c3aed]/40 ring-1 ring-[#7c3aed]/20' : ''
|
|
51
|
-
}`}
|
|
52
|
-
>
|
|
53
|
-
{onSelect && (
|
|
54
|
-
<button
|
|
55
|
-
onClick={(e) => {
|
|
56
|
-
e.stopPropagation();
|
|
57
|
-
onSelect(row.id);
|
|
58
|
-
}}
|
|
59
|
-
className={`absolute top-3 right-3 w-5 h-5 rounded border flex items-center justify-center transition-all ${isSelected
|
|
60
|
-
? 'bg-[#7c3aed] border-[#7c3aed]'
|
|
61
|
-
: 'border-[color:color-mix(in_srgb,var(--th-ov-base)_10%,transparent)] opacity-0 group-hover:opacity-100'
|
|
62
|
-
}`}
|
|
63
|
-
>
|
|
64
|
-
{isSelected && <Icon icon="Check" size={11} className="text-white" />}
|
|
65
|
-
</button>
|
|
66
|
-
)}
|
|
67
|
-
|
|
68
|
-
<div className="flex items-center gap-2 mb-3">
|
|
69
|
-
<span className={`w-2 h-2 rounded-full ${sc.dot}`} />
|
|
70
|
-
<span
|
|
71
|
-
className={`text-[9px] px-1.5 py-0.5 rounded font-medium capitalize ${sc.bg} ${sc.text}`}
|
|
72
|
-
>
|
|
73
|
-
{row.status}
|
|
74
|
-
</span>
|
|
75
|
-
{row.npsScore !== null && row.npsScore !== undefined && (
|
|
76
|
-
<span
|
|
77
|
-
className={`text-[9px] px-1.5 py-0.5 rounded font-bold ${row.npsScore >= 70
|
|
78
|
-
? 'bg-[color:color-mix(in_srgb,var(--th-success)_10%,transparent)] text-[color:var(--th-success)]'
|
|
79
|
-
: 'bg-[color:color-mix(in_srgb,var(--th-warning-soft)_10%,transparent)] text-[color:var(--th-warning-soft)]'
|
|
80
|
-
}`}
|
|
81
|
-
>
|
|
82
|
-
NPS {row.npsScore}
|
|
83
|
-
</span>
|
|
84
|
-
)}
|
|
85
|
-
</div>
|
|
86
|
-
|
|
87
|
-
<h3 className="text-[14px] font-semibold text-white mb-1 truncate pr-6">
|
|
88
|
-
{row.name}
|
|
89
|
-
</h3>
|
|
90
|
-
|
|
91
|
-
{row.description && (
|
|
92
|
-
<p className="text-[11px] text-[color:var(--th-text-3)] line-clamp-2 mb-3">
|
|
93
|
-
{row.description}
|
|
94
|
-
</p>
|
|
95
|
-
)}
|
|
96
|
-
|
|
97
|
-
<div className="mt-auto pt-3 border-t border-[color:color-mix(in_srgb,var(--th-ov-base)_5%,transparent)]">
|
|
98
|
-
<div className="flex items-center justify-between text-[11px] mb-1.5">
|
|
99
|
-
<span className="text-[color:var(--th-text-3)]">Responses</span>
|
|
100
|
-
<span className="text-[color:var(--th-text-1)] font-mono tabular-nums">
|
|
101
|
-
{row.responses.toLocaleString()} / {row.target.toLocaleString()}
|
|
102
|
-
</span>
|
|
103
|
-
</div>
|
|
104
|
-
<div className="h-1.5 rounded-full bg-[color:color-mix(in_srgb,var(--th-ov-base)_5%,transparent)] overflow-hidden">
|
|
105
|
-
<div
|
|
106
|
-
className={`h-full rounded-full ${pct >= 80 ? 'bg-[#4edea3]' : 'bg-[#7c3aed]'
|
|
107
|
-
}`}
|
|
108
|
-
style={{ width: `${pct}%` }}
|
|
109
|
-
/>
|
|
110
|
-
</div>
|
|
111
|
-
</div>
|
|
112
|
-
|
|
113
|
-
<div className="flex items-center justify-between mt-3 text-[10px] text-[color:var(--th-text-3)]">
|
|
114
|
-
<span className="flex items-center gap-1">
|
|
115
|
-
<Icon icon="HelpCircle" size={10} /> {row.questionCount} questions
|
|
116
|
-
</span>
|
|
117
|
-
<span>{row.createdByName}</span>
|
|
118
|
-
</div>
|
|
119
|
-
</Card>
|
|
120
|
-
</div>
|
|
121
|
-
);
|
|
122
|
-
};
|
|
123
|
-
|
|
124
|
-
SurveyGridCard.displayName = 'SurveyGridCard';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {AllSurveys} from './Allsurvey'
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import type { ColumnDef } from '@/shared/components/DataTable/types';
|
|
2
|
-
import type { SurveyRow } from '../../types/survey.types';
|
|
3
|
-
|
|
4
|
-
/* Fallback columns, used until GET /tables/surveys/config responds.
|
|
5
|
-
(Same idea as queue's pendingTable.config.ts — columns live in a config file, not in the page.)
|
|
6
|
-
`cellType` values must match the types registered in cells/SurveyCells.tsx. */
|
|
7
|
-
export const surveysColumns: ColumnDef<SurveyRow>[] = [
|
|
8
|
-
{ key: 'name', label: 'Survey', cellType: 'surveyName', sortable: true, minWidth: 260 },
|
|
9
|
-
{ key: 'status', label: 'Status', cellType: 'surveyStatus', sortable: true, width: 90, align: 'center' },
|
|
10
|
-
{ key: 'responses', label: 'Responses', cellType: 'responseProgress', sortable: true, width: 160 },
|
|
11
|
-
{ key: 'npsScore', label: 'NPS Score', cellType: 'npsScore', sortable: true, width: 110 },
|
|
12
|
-
{ key: 'questionCount', label: 'Questions', sortable: false, width: 100 },
|
|
13
|
-
{ key: 'createdByName', label: 'Created By', sortable: false, width: 160 },
|
|
14
|
-
{ key: 'updatedAt', label: 'Updated', sortable: true, width: 130 },
|
|
15
|
-
];
|