From 7e967507fb0acb93af072063a3ce92b7a017d908 Mon Sep 17 00:00:00 2001
From: log101
Date: Tue, 30 Jan 2024 21:49:15 +0300
Subject: [PATCH] stlye: highlight map if location is not selected
---
src/pages/[id].astro | 8 ++++----
src/pages/index.astro | 42 +++++++++++++++++++++++++++++++++++++++---
2 files changed, 43 insertions(+), 7 deletions(-)
diff --git a/src/pages/[id].astro b/src/pages/[id].astro
index b2310c9..e7cbd46 100644
--- a/src/pages/[id].astro
+++ b/src/pages/[id].astro
@@ -17,7 +17,7 @@ import { Separator } from '@/components/ui/separator';
import type { ContentTable } from '@/lib/db';
import dayjs from 'dayjs';
import relativeTime from 'dayjs/plugin/relativeTime';
-import localeTR from 'dayjs/locale/tr';
+import utc from 'dayjs/plugin/utc';
type Content = Omit;
@@ -29,12 +29,12 @@ const res = await fetch(
const data: Content | null = res.status === 200 ? await res.json() : null;
-dayjs.locale(localeTR);
-
dayjs.extend(relativeTime);
+dayjs.extend(utc);
+
// @ts-expect-error Generated is string
-const dateFromNow = dayjs(data?.created_at).fromNow();
+const dateFromNow = dayjs(data?.created_at).add(3, 'hour').from(dayjs.utc());
---
diff --git a/src/pages/index.astro b/src/pages/index.astro
index 5f092bb..4df77cf 100644
--- a/src/pages/index.astro
+++ b/src/pages/index.astro
@@ -44,7 +44,12 @@ import { Label } from '@/components/ui/label';
getirilecek.
-
+
Galerinizden bir fotoğraf seçin.
@@ -62,14 +67,23 @@ import { Label } from '@/components/ui/label';
gittiği zaman seçtiğiniz fotoğrafı görebilecek.
-
+
+
Seçilen Konum:
-
+
+
Henüz konum seçmediniz, konum seçmek için haritadaki bir noktaya
basınız.
+
@@ -100,6 +115,7 @@ import { Label } from '@/components/ui/label';
placeholder="Açıklamanızı buraya yazınız."
name="description"
id="location-description"
+ required
/>
Bir açıklama girin, yüklediğiniz içeriğin üzerine bu metin
@@ -132,6 +148,26 @@ import { Label } from '@/components/ui/label';
const handleSubmit = async (e: SubmitEvent) => {
e.preventDefault();
+ const locationSelected = document.getElementById(
+ 'location-selected-confirmation'
+ )?.innerText;
+
+ if (!locationSelected) {
+ const coordinatesText = document.getElementById('coordinates');
+
+ const mapDiv = document.getElementById('map');
+
+ mapDiv?.classList.add('border-slate-700');
+ coordinatesText?.classList.add('drop-shadow-xl');
+
+ setTimeout(() => {
+ mapDiv?.classList.remove('border-slate-700');
+ coordinatesText?.classList.remove('drop-shadow-xl');
+ }, 500);
+
+ return;
+ }
+
const submitButton = document.getElementById(
'submit-button'
) as HTMLButtonElement;