Skip to content

Commit

Permalink
fix: edit og, decoration, form parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
petchill committed Nov 7, 2023
1 parent 562340d commit 24339c1
Show file tree
Hide file tree
Showing 6 changed files with 133 additions and 25 deletions.
4 changes: 1 addition & 3 deletions models/src/document.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@ export const documentSchema = object({
location: string([toTrimmed(), minLength(1)]),
day: string('วันที่ไม่ถูกต้อง', [regex(/([1-9]|[12][0-9]|3[01])/)]),
month: string('เดือนไม่ถูกต้อง', [regex(/[1-9]|1[0-2]/)]),
year: string('ปีไม่ถูกต้อง', [
regex(/(190[0-9]|19[1-9][0-9]|20[0-9]{2}|2100)/),
]),
year: string('ปีไม่ถูกต้อง', [regex(/(20[0-9]{2}|19[789]\d)+543/)]),
[PERSONALID_KEY]: string([toTrimmed(), length(13)]),
prefix: optional(string()),
email: optional(string()),
Expand Down
6 changes: 3 additions & 3 deletions web/src/components/event-reasons.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -88,11 +88,11 @@
หลักการสำคัญ ของกฎหมายฉบับนี้
</h2>
<div
class="w-full flex flex-wrap justify-center md:space-x-[20px] mb-[20px]"
class="w-full flex flex-wrap justify-center md:space-x-[40px] mb-[40px]"
>
{#each mainTopics as topic, i}
<div
class="md:w-[85vw] max-w-[320px] flex flex-col items-center mt-[20px]"
class="md:w-[85vw] max-w-[280px] flex flex-col items-center mt-[40px]"
>
<img class="w-[120px]" src={topic.image} alt={`main-topic-${i}`} />
<p class="text-body-02-normal text-base-100 mt-[10px]">
Expand All @@ -116,7 +116,7 @@
<div class="w-full flex flex-wrap justify-center space-x-[20px]">
{#each reasonsForEdition as reason, i}
<div
class="md:w-[85vw] max-w-[320px] flex flex-col mt-[20px] text-body-02-normal"
class="md:w-[85vw] max-w-[280px] flex flex-col mt-[40px] text-body-02-normal"
>
<p class="font-semibold text-primary">
{reason.highlightText}
Expand Down
4 changes: 3 additions & 1 deletion web/src/components/petition.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@
>
<div class="md:max-w-[320px]">
<h2 class="heading-responsive-02">ร่วมลงชื่อ</h2>
<p>เพื่อเสนอกฎหมาย ผู้สูงอายุและบำนาญพื้นฐานแห่งชาติ พ.ศ. ...</p>
<p>
เพื่อเสนอกฎหมาย ผู้สูงอายุและบำนาญพื้นฐานแห่งชาติ(ฉบับที่ ..) พ.ศ. ...
</p>
<div class="p-[10px] text-neutral bg-primary-focus rounded-[8px]">
<p class="font-semibold">คุณสมบัติของผู้เข้าชื่อเสนอกฎหมาย</p>
<ul class="list-disc list-inside">
Expand Down
21 changes: 15 additions & 6 deletions web/src/components/signature-form.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,18 @@
let monthOptions = [...Array.from({ length: 12 }, (_, i) => i + 1)];
let yearOptions = [
...Array.from({ length: 100 }, (_, i) => new Date().getFullYear() - i),
...Array.from(
{ length: 100 },
(_, i) => new Date().getFullYear() - i + 543
),
];
const thisDate = new Date();
let dateValue = {
day: thisDate.getDate(),
month: thisDate.getMonth() + 1,
year: thisDate.getFullYear(),
year: thisDate.getFullYear() + 543,
};
const setDateOptions = () => {
Expand All @@ -57,6 +60,9 @@
const { form, setTouched, setData, data, reset } = createForm({
validate(values) {
try {
values.day = dateValue.day.toString();
values.month = dateValue.month.toString();
values.year = dateValue.year.toString();
parse(documentSchema, values);
} catch (e) {
return flatten(e as ValiError).nested;
Expand All @@ -66,14 +72,16 @@
async onSubmit(values) {
isLoading = true;
try {
values.day = dateValue.day;
values.month = dateValue.month;
values.year = dateValue.year;
values.day = dateValue.day.toString();
values.month = dateValue.month.toString();
values.year = dateValue.year.toString();
console.log(values);
await submitDocument(parse(documentSchema, values));
successDialog.showModal();
clearPad();
reset();
} catch (e) {
console.log(e);
errorDialog.showModal();
}
isLoading = false;
Expand Down Expand Up @@ -391,7 +399,8 @@
/>
<span class="label-text"
>ข้าพเจ้ายินยอมลงชื่อเสนอกฎหมาย <a
href="/privacy-policy"
href="https://drive.google.com/file/d/1r8MtAdoqSPW37I4aQrgID5U1cFHqy-R2/view"
target="_blank"
class="underline">อ่านนโยบายการคุ้มครองข้อมูลส่วนบุคคล</a
></span
>
Expand Down
112 changes: 107 additions & 5 deletions web/src/components/welcome.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
เปลี่ยนจาก<span class="text-secondary font-semibold"
>เบี้ยยังชีพแบบรัฐสงเคราะห์</span
>
ให้เป็น<span class="text-primary ffont-semibold"
ให้เป็น<span class="text-primary font-semibold"
>บำนาญถ้วนหน้าด้วยรัฐสวัสดิการ</span
>
</p>
Expand All @@ -39,7 +39,7 @@
</p>
<a
href="#petition"
class="btn btn-block bg-primary hover:bg-primary-focus text-body-03-semibold text-base-100 md:w-[85vw] md:max-w-[450px]"
class="btn btn-block bg-primary border-[0px] hover:bg-primary-focus text-body-03-semibold text-base-100 md:w-[85vw] md:max-w-[450px]"
>
ลงชื่อเลย
<img src="/icons/pen.svg" alt="icon-pen" fill="#FFD3C9" />
Expand All @@ -49,8 +49,110 @@

<style>
.highlight {
text-shadow: -4px -4px 3px white, 4px -4px 3px white, -4px 4px 3px white,
4px 4px 3px white, -4px 0px 3px white, 4px 0px 3px white,
0px -4px 3px white, 0px 4px 3px white;
text-shadow:
/* -8px -8px 1px white, */
/* -7px -8px 1px white, */
/* -6px -8px 1px white, */
/* -5px -8px 1px white, */ -4px -8px
1px white,
-3px -8px 1px white, -2px -8px 1px white, -1px -8px 1px white,
0px -8px 1px white, 1px -8px 1px white, 2px -8px 1px white,
3px -8px 1px white, 4px -8px 1px white,
/* 5px -8px 1px white, */ /* 6px -8px 1px white, */
/* 7px -8px 1px white, */ /* 8px -8px 1px white, */
/* -8px -7px 1px white, */ /* -7px -7px 1px white, */ -6px -7px 1px
white,
-5px -7px 1px white, -4px -7px 1px white, -3px -7px 1px white,
-2px -7px 1px white, -1px -7px 1px white, 0px -7px 1px white,
1px -7px 1px white, 2px -7px 1px white, 3px -7px 1px white,
4px -7px 1px white, 5px -7px 1px white, 6px -7px 1px white,
/* 7px -7px 1px white, */ /* 8px -7px 1px white, */
/* -8px -6px 1px white, */ -7px -6px 1px white,
/* -6px -6px 1px white, */ -5px -6px 1px white, -4px -6px 1px white,
-3px -6px 1px white, -2px -6px 1px white, -1px -6px 1px white,
0px -6px 1px white, 1px -6px 1px white, 2px -6px 1px white,
3px -6px 1px white, 4px -6px 1px white, 5px -6px 1px white,
/* 6px -6px 1px white, */ 7px -6px 1px white,
/* 8px -6px 1px white, */ /* -8px -5px 1px white, */ -7px -5px 1px white,
-6px -5px 1px white, -5px -5px 1px white, -4px -5px 1px white,
-3px -5px 1px white, -2px -5px 1px white, -1px -5px 1px white,
0px -5px 1px white, 1px -5px 1px white, 2px -5px 1px white,
3px -5px 1px white, 4px -5px 1px white, 5px -5px 1px white,
6px -5px 1px white, 7px -5px 1px white,
/* 8px -5px 1px white, */ -8px -4px 1px white, -7px -4px 1px white,
-6px -4px 1px white, -5px -4px 1px white, -4px -4px 1px white,
-3px -4px 1px white, -2px -4px 1px white, -1px -4px 1px white,
0px -4px 1px white, 1px -4px 1px white, 2px -4px 1px white,
3px -4px 1px white, 4px -4px 1px white, 5px -4px 1px white,
6px -4px 1px white, 7px -4px 1px white, 8px -4px 1px white,
-8px -3px 1px white, -7px -3px 1px white, -6px -3px 1px white,
-5px -3px 1px white, -4px -3px 1px white, -3px -3px 1px white,
-2px -3px 1px white, -1px -3px 1px white, 0px -3px 1px white,
1px -3px 1px white, 2px -3px 1px white, 3px -3px 1px white,
4px -3px 1px white, 5px -3px 1px white, 6px -3px 1px white,
7px -3px 1px white, 8px -3px 1px white, -8px -2px 1px white,
-7px -2px 1px white, -6px -2px 1px white, -5px -2px 1px white,
-4px -2px 1px white, -3px -2px 1px white, -2px -2px 1px white,
-1px -2px 1px white, 0px -2px 1px white, 1px -2px 1px white,
2px -2px 1px white, 3px -2px 1px white, 4px -2px 1px white,
5px -2px 1px white, 6px -2px 1px white, 7px -2px 1px white,
8px -2px 1px white, -8px -1px 1px white, -7px -1px 1px white,
-6px -1px 1px white, -5px -1px 1px white, -4px -1px 1px white,
-3px -1px 1px white, -2px -1px 1px white, -1px -1px 1px white,
0px -1px 1px white, 1px -1px 1px white, 2px -1px 1px white,
3px -1px 1px white, 4px -1px 1px white, 5px -1px 1px white,
6px -1px 1px white, 7px -1px 1px white, 8px -1px 1px white,
-8px 0px 1px white, -7px 0px 1px white, -6px 0px 1px white,
-5px 0px 1px white, -4px 0px 1px white, -3px 0px 1px white,
-2px 0px 1px white, -1px 0px 1px white, 0px 0px 1px white,
1px 0px 1px white, 2px 0px 1px white, 3px 0px 1px white, 4px 0px 1px white,
5px 0px 1px white, 6px 0px 1px white, 7px 0px 1px white, 8px 0px 1px white,
-8px 1px 1px white, -7px 1px 1px white, -6px 1px 1px white,
-5px 1px 1px white, -4px 1px 1px white, -3px 1px 1px white,
-2px 1px 1px white, -1px 1px 1px white, 0px 1px 1px white,
1px 1px 1px white, 2px 1px 1px white, 3px 1px 1px white, 4px 1px 1px white,
5px 1px 1px white, 6px 1px 1px white, 7px 1px 1px white, 8px 1px 1px white,
-8px 2px 1px white, -7px 2px 1px white, -6px 2px 1px white,
-5px 2px 1px white, -4px 2px 1px white, -3px 2px 1px white,
-2px 2px 1px white, -1px 2px 1px white, 0px 2px 1px white,
1px 2px 1px white, 2px 2px 1px white, 3px 2px 1px white, 4px 2px 1px white,
5px 2px 1px white, 6px 2px 1px white, 7px 2px 1px white, 8px 2px 1px white,
-8px 3px 1px white, -7px 3px 1px white, -6px 3px 1px white,
-5px 3px 1px white, -4px 3px 1px white, -3px 3px 1px white,
-2px 3px 1px white, -1px 3px 1px white, 0px 3px 1px white,
1px 3px 1px white, 2px 3px 1px white, 3px 3px 1px white, 4px 3px 1px white,
5px 3px 1px white, 6px 3px 1px white, 7px 3px 1px white, 8px 3px 1px white,
-8px 4px 1px white, -7px 4px 1px white, -6px 4px 1px white,
-5px 4px 1px white, -4px 4px 1px white, -3px 4px 1px white,
-2px 4px 1px white, -1px 4px 1px white, 0px 4px 1px white,
1px 4px 1px white, 2px 4px 1px white, 3px 4px 1px white, 4px 4px 1px white,
5px 4px 1px white, 6px 4px 1px white, 7px 4px 1px white, 8px 4px 1px white,
/* -8px 5px 1px white, */ -7px 5px 1px white, -6px 5px 1px white,
-5px 5px 1px white, -4px 5px 1px white, -3px 5px 1px white,
-2px 5px 1px white, -1px 5px 1px white, 0px 5px 1px white,
1px 5px 1px white, 2px 5px 1px white, 3px 5px 1px white, 4px 5px 1px white,
5px 5px 1px white, 6px 5px 1px white, 7px 5px 1px white,
/* 8px 5px 1px white, */ /* -8px 6px 1px white, */ -7px 6px 1px white,
/* -6px 6px 1px white, */ -5px 6px 1px white, -4px 6px 1px white,
-3px 6px 1px white, -2px 6px 1px white, -1px 6px 1px white,
0px 6px 1px white, 1px 6px 1px white, 2px 6px 1px white, 3px 6px 1px white,
4px 6px 1px white, 5px 6px 1px white,
/* 6px 6px 1px white, */ 7px 6px 1px white,
/* 8px 6px 1px white, */ /* -8px 7px 1px white, */
/* -7px 7px 1px white, */ -6px 7px 1px white,
-5px 7px 1px white, -4px 7px 1px white, -3px 7px 1px white,
-2px 7px 1px white, -1px 7px 1px white, 0px 7px 1px white,
1px 7px 1px white, 2px 7px 1px white, 3px 7px 1px white, 4px 7px 1px white,
5px 7px 1px white, 6px 7px 1px white,
/* 7px 7px 1px white, */ /* 8px 7px 1px white, */
/* -8px 8px 1px white, */ /* -7px 8px 1px white, */
/* -6px 8px 1px white, */ /* -5px 8px 1px white, */ -4px 8px 1px white,
-3px 8px 1px white, -2px 8px 1px white, -1px 8px 1px white,
0px 8px 1px white, 1px 8px 1px white, 2px 8px 1px white, 3px 8px 1px white,
4px 8px 1px white;
/* 5px 8px 1px white, */
/* 6px 8px 1px white, */
/* 7px 8px 1px white, */
/* 8px 8px 1px white, */
}
</style>
11 changes: 4 additions & 7 deletions web/src/layouts/main.astro
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,19 @@ import { WEB_URI } from '@pension-act/constants';

<html lang="en">
<head>
<title>Pension Act</title>
<title>Pension 4all</title>
<meta charset="utf-8" />
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
<meta name="viewport" content="width=device-width" />
<meta name="generator" content={Astro.generator} />
<meta
name="description"
content="ต้องการ 10,000 ชื่อ เปลี่ยนจากเบี้ยยังชีพแบบรัฐสงเคราะห์ ให้เป็นบำนาญถ้วนหน้าด้วยรัฐสวัสดิการ"
/>
<meta
property="og:title"
content="ร่วมลงชื่อเสนอกฎหมาย บำนาญพื้นฐานแห่งชาติ"
content="ต้องการ 10,000 ชื่อ สร้างหลักประกันตอนสูงวัยให้เราทุกคน"
/>
<meta property="og:title" content="ลงชื่อเสนอ กม. บำนาญพื้นฐานถ้วนหน้า" />
<meta
property="og:description"
content="ต้องการ 10,000 ชื่อ เปลี่ยนจากเบี้ยยังชีพแบบรัฐสงเคราะห์ ให้เป็นบำนาญถ้วนหน้าด้วยรัฐสวัสดิการ"
content="ต้องการ 10,000 ชื่อ สร้างหลักประกันตอนสูงวัยให้เราทุกคน"
/>
<meta property="og:image" content="/og.jpg" />

Expand Down

0 comments on commit 24339c1

Please sign in to comment.