row.index + 1,
+ size: 25,
+ meta: {
+ align: "center",
+ },
+ }),
+ columnHelper.accessor("source", {
+ header: () => "Marketplace",
+ cell: (props) => {
+ const s = props.getValue();
+ return formatSource(s);
+ },
+ size: 85,
+ meta: {
+ align: "left",
+ },
+ }),
+ columnHelper.accessor("id", {
+ header: () => "Survey ID",
+ cell: (props) => {
+ return truncate(props.getValue(), 6, "*****").toUpperCase();
+ },
+ size: 70,
+ meta: {
+ align: "left",
+ },
+ }),
+ columnHelper.accessor("payout", {
+ header: () => "Amount",
+ cell: (props) => {
+ const val = props.renderValue() as number;
+ return formatCentsToUSD(val);
+ },
+ size: 50,
+ meta: {
+ align: "center",
+ },
+ }),
+ columnHelper.accessor("loi", {
+ header: () => "Duration",
+ cell: (props) => {
+ const val = props.renderValue() as number;
+ return `${Math.round(val / 60)} min`;
+ },
+ size: 50,
+ meta: {
+ align: "center",
+ },
+ }),
+ ];
+
+ const table = useReactTable({
+ data: bucket.contents,
+ columns: columns,
+ getCoreRowModel: getCoreRowModel(),
+ });
+
+ return (
+ <>
+
setShowDetails(!showDetails)}
- >
- ({showDetails ? 'Hide' : 'Show'} details of surveys in this bucket)
-
-
- {showDetails && (
-
-
-
- {table.getHeaderGroups().map((headerGroup) => (
-
-
- {headerGroup.headers.map((header) => {
- const align = header.column.columnDef.meta?.align || 'left';
- const alignClass = align === 'center' ? 'text-center' : align === 'right' ? 'text-right' : 'text-left';
-
- return (
- |
- {flexRender(
- header.column.columnDef.header,
- header.getContext(),
- )}
- |
- )
- })}
-
- ))}
-
-
- {table.getRowModel().rows.map((row) => (
-
- {row.getVisibleCells().map((cell) => {
- const align = cell.column.columnDef.meta?.align || 'left';
- const alignClass = align === 'center' ? 'text-center' :
- align === 'right' ? 'text-right' : 'text-left';
-
- return (
- |
- {flexRender(cell.column.columnDef.cell, cell.getContext())}
- |
- )
- })}
-
- ))}
-
-
-
-
- )}
- >
- )
+ onClick={() => setShowDetails(!showDetails)}
+ >
+ ({showDetails ? "Hide" : "Show"} details of surveys in this bucket)
+
+
+ {showDetails && (
+
-
- Your balance is low.
-
-
- You may continue to attempt surveys, but you will be
- advised to return the HIT if your survey attempt does
- not result in a complete.
-
-
- HIT submissions with a balance exceeding -$1.00 will
- return in rejected assignments.
-
-
- )}
-
-
+
+ Your balance is low.
+
+
+ You may continue to attempt surveys, but you will be advised to
+ return the HIT if your survey attempt does not result in a complete.
+
+
+ HIT submissions with a balance exceeding -$1.00 will return in
+ rejected assignments.
+
+
+ )}
+
+
- No Assignment ID found. Please access this page through
- the Amazon Mechanical Turk platform.
-
- )
- }
+ const entered = useAppSelector((state) => state.app.currentBucketEntered);
+ const assignment_id = useAppSelector((state) => state.app.assignment_id);
+ if (!assignment_id) {
return (
- <>
- {entered ? (
-
+ No Assignment ID found. Please access this page through the Amazon
+ Mechanical Turk platform.
+
+ );
+ }
+
+ return <>{entered ?