Skip to content

Commit 28a1974

Browse files
authored
Merge pull request #48 from git-vish/development
fe: fix page size
2 parents ac9000e + 426322d commit 28a1974

File tree

6 files changed

+46
-36
lines changed

6 files changed

+46
-36
lines changed

backend/.env.example

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Formwise - Environment Configuration Example
2+
3+
# *** MongoDB Configuration ***
4+
# Provide a valid MongoDB connection string
5+
# For local development, you can use: mongodb://localhost:27017
6+
# For Atlas or other cloud providers, use their provided connection string
7+
MONGO_URI=mongodb+srv://<username>:<password>@cluster.mongodb.net/<database>?retryWrites=true&w=majority
8+
9+
# *** Application Security ***
10+
# Use a strong, randomly generated secret for JWT
11+
# Recommendation: Use a tool like `openssl rand -hex 32` to generate
12+
JWT_SECRET=your_very_long_and_complex_random_secret_key_here
13+
14+
# *** Google OAuth Configuration ***
15+
# Obtain these from the Google Cloud Console
16+
# https://console.cloud.google.com/apis/credentials
17+
GOOGLE_CLIENT_ID=your_google_oauth_client_id.apps.googleusercontent.com
18+
GOOGLE_CLIENT_SECRET=your_google_oauth_client_secret
19+
20+
# *** Groq API Configuration ***
21+
# Obtain an API key from https://console.groq.com/keys
22+
GROQ_API_KEY=your_groq_api_key
23+
24+
# *** LangChain Tracing (Optional) ***
25+
# Sign up at https://smith.langchain.com
26+
LANGCHAIN_API_KEY=your_langchain_api_key
27+
LANGCHAIN_ENDPOINT=https://api.smith.langchain.com
28+
LANGCHAIN_PROJECT=formwise
29+
LANGCHAIN_TRACING_V2=true
30+
31+
# *** Observability (Optional) ***
32+
# Logfire token for additional monitoring
33+
# Remove or leave blank if not using
34+
LOGFIRE_TOKEN=

backend/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[project]
22
name = "formwise"
33
version = "0.1.0"
4-
description = "Add your description here"
4+
description = "A FastAPI backend for Formwise, enabling AI-powered form creation with Groq LLM."
55
readme = "README.md"
66
requires-python = ">=3.12"
77
dependencies = [

frontend/.env.local.example

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# API URL
2+
NEXT_PUBLIC_API_URL="http://localhost:8000/api"

frontend/components/form/form-responses.tsx

Lines changed: 2 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,6 @@ import { ScrollArea, ScrollBar } from "@/components/ui/scroll-area";
2424
import { FORM_URLS } from "@/config/api-urls";
2525
import { tokenService } from "@/lib/services/token";
2626
import { formatDate, formatDateTime } from "@/lib/utils";
27-
import { SelectTrigger, SelectValue } from "@radix-ui/react-select";
28-
import { Select, SelectContent, SelectItem } from "../ui/select";
2927

3028
// Define response type based on your API structure
3129
interface FormResponse {
@@ -44,7 +42,7 @@ export default function FormResponses({ form }: FormResponsesProps) {
4442
const [error, setError] = useState<string | null>(null);
4543
const [pagination, setPagination] = useState<PaginationState>({
4644
pageIndex: 0,
47-
pageSize: 10,
45+
pageSize: 10, // Fixed page size
4846
});
4947

5048
// Fetch form responses
@@ -218,34 +216,7 @@ export default function FormResponses({ form }: FormResponsesProps) {
218216
<ScrollBar orientation="horizontal" />
219217
</ScrollArea>
220218

221-
<div className="flex items-center px-2">
222-
{/* Rows per page selector */}
223-
<div className="flex items-center space-x-2">
224-
<span className="text-sm text-muted-foreground">
225-
Rows per page
226-
</span>
227-
<Select
228-
value={pagination.pageSize.toString()}
229-
onValueChange={(value: string) =>
230-
setPagination((prev) => ({
231-
...prev,
232-
pageSize: parseInt(value),
233-
}))
234-
}
235-
>
236-
<SelectTrigger className="h-8 w-[70px] border">
237-
<SelectValue placeholder={pagination.pageSize} />
238-
</SelectTrigger>
239-
<SelectContent side="top">
240-
{[10, 30, 50].map((pageSize) => (
241-
<SelectItem key={pageSize} value={pageSize.toString()}>
242-
{pageSize}
243-
</SelectItem>
244-
))}
245-
</SelectContent>
246-
</Select>
247-
</div>
248-
219+
<div className="flex items-center justify-center px-2">
249220
{/* Pagination controls */}
250221
<div className="flex items-center space-x-2">
251222
<Button

frontend/lib/schemas.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { z } from "zod";
22
import type { Form } from "@/types/form";
33
import type { DateField, Field, NumberField } from "@/types/field";
4+
import { formatDate } from "@/lib/utils";
45

56
// Base schemas
67
const emailSchema = z
@@ -116,15 +117,17 @@ export function generateFormwiseSchema(form: Form) {
116117
case "date":
117118
fieldSchema = z.date();
118119
if ((field as DateField).min_date) {
120+
const minDate = new Date((field as DateField).min_date!);
119121
fieldSchema = (fieldSchema as z.ZodDate).min(
120-
new Date((field as DateField).min_date!),
121-
"Date is too early"
122+
minDate,
123+
`Date must be on or after ${formatDate(minDate.toISOString())}`
122124
);
123125
}
124126
if ((field as DateField).max_date) {
127+
const maxDate = new Date((field as DateField).max_date!);
125128
fieldSchema = (fieldSchema as z.ZodDate).max(
126-
new Date((field as DateField).max_date!),
127-
"Date is too late"
129+
maxDate,
130+
`Date must be on or before ${formatDate(maxDate.toISOString())}`
128131
);
129132
}
130133
break;

images/formwise.png

997 KB
Loading

0 commit comments

Comments
 (0)