-
+ })
}
diff --git a/frontend/src/def/Question.d.ts b/frontend/src/def/Question.d.ts
index a59395c8..136bfd63 100644
--- a/frontend/src/def/Question.d.ts
+++ b/frontend/src/def/Question.d.ts
@@ -6,7 +6,7 @@ export interface Question {
tags: string[];
likes: number;
dislikes: number;
- rating: "like" | "dislike" | "none";
+ opinion: "like" | "dislike" | "none";
answers: number;
created: string;
updated: string;
@@ -19,12 +19,12 @@ export interface Answer {
created: string;
likes: number;
dislikes: number;
- rating: "like" | "dislike" | "none";
+ opinion: "like" | "dislike" | "none";
author: Author;
}
interface Author {
id: string;
name: string;
- type: "user" | "pro" | "ai";
+ type: "guest" | "user" | "pro" | "admin" | "ai";
}
diff --git a/frontend/src/def/cool-blobs.ts b/frontend/src/def/cool-blobs.ts
new file mode 100644
index 00000000..4d023e96
--- /dev/null
+++ b/frontend/src/def/cool-blobs.ts
@@ -0,0 +1,30 @@
+import React from "react";
+
+export const animateBlob = (e: React.MouseEvent) => {
+ const _blob = e.currentTarget.querySelector("span.button-blob");
+ if (!_blob) return;
+ let blob = _blob as HTMLElement;
+
+ let buttonRect = e.currentTarget.getBoundingClientRect();
+ let docEl = document.documentElement;
+ let left = buttonRect.left + (window.pageXOffset || docEl.scrollLeft || 0);
+
+ let x = e.clientX - left;
+
+ const fromLeftLimit = 30;
+ const fromRightLimit = (buttonRect.width - fromLeftLimit);
+ let fromX = x < fromLeftLimit ? fromLeftLimit : x > fromRightLimit ? fromRightLimit : x;
+
+ const toLeftLimit = 60;
+ const toRightLimit = (buttonRect.width - toLeftLimit);
+ let toX = x < toLeftLimit ? toLeftLimit : x > toRightLimit ? toRightLimit : x;
+
+ if (blob.animate) blob.animate([
+ { opacity: 1, width: "60px", height: "80%", top: "10%", transform: "translateX(calc(" + fromX + "px - 50%))" },
+ { opacity: 0, width: "120px", height: "100%", top: 0, transform: "translateX(calc(" + toX + "px - 50%))" }
+ ], {
+ duration: 400,
+ fill: "forwards",
+ easing: "ease"
+ });
+}
diff --git a/frontend/src/index.scss b/frontend/src/index.scss
index 8f153808..c0cb036c 100644
--- a/frontend/src/index.scss
+++ b/frontend/src/index.scss
@@ -95,15 +95,6 @@ code {
}
}
-.avatar {
- border-radius: 50%;
- filter: drop-shadow(0 0 2px rgba(0, 0, 0, 0.5));
- height: 40px !important;
- object-fit: cover;
- pointer-events: none;
- width: 40px !important;
-}
-
::selection {
background-color: var(--primary-color);
color: var(--primary-color-contrast);
@@ -259,3 +250,23 @@ hr {
color: var(--primary-color-contrast);
}
}
+
+*:has(> span.button-blob) {
+ position: relative;
+
+ * {
+ z-index: 10;
+ }
+
+ span.button-blob {
+ position: absolute;
+ height: 100%;
+ width: 60px;
+ top: 0;
+ left: 0;
+ border-radius: var(--border-radius);
+ background: var(--border-color);
+ z-index: 1;
+ opacity: 0;
+ }
+}
diff --git a/frontend/src/locales/en/translation.json b/frontend/src/locales/en/translation.json
index dfd8db2d..1a0eb7c9 100644
--- a/frontend/src/locales/en/translation.json
+++ b/frontend/src/locales/en/translation.json
@@ -90,6 +90,14 @@
}
},
"submit": "Post your Question"
+ },
+ "questionView": {
+ "answer": {
+ "creationDate": "replied {{answerCreationDate}}",
+ "likes": "likes",
+ "dislikes": "dislikes",
+ "report": "Report answer"
+ }
}
}
}
diff --git a/frontend/src/pages/dashboard/Dashboard.scss b/frontend/src/pages/dashboard/Dashboard.scss
index defc6a4e..e6550a17 100644
--- a/frontend/src/pages/dashboard/Dashboard.scss
+++ b/frontend/src/pages/dashboard/Dashboard.scss
@@ -30,7 +30,7 @@
justify-content: center;
}
- a {
+ a.navigate {
align-items: center;
border-radius: var(--border-radius) 0 0 var(--border-radius);
color: inherit;
diff --git a/frontend/src/pages/dashboard/Dashboard.tsx b/frontend/src/pages/dashboard/Dashboard.tsx
index 5900e40b..28b3c513 100644
--- a/frontend/src/pages/dashboard/Dashboard.tsx
+++ b/frontend/src/pages/dashboard/Dashboard.tsx
@@ -14,6 +14,8 @@ import Skeleton from "react-loading-skeleton";
import Search from "../../components/search/Search";
import { axiosError } from "../../def/axios-error";
import { useAlert } from "react-alert";
+import Avatar from "../../components/avatar/Avatar";
+import { animateBlob } from "../../def/cool-blobs";
// ory setup
const basePath = "http://localhost:4000"
@@ -56,7 +58,7 @@ export default function Dashboard(props: Props) {
if (window.location.pathname.includes("/question")) {
let questionId = window.location.pathname.split("/question/")[1].substring(0, 36);
global.axios.get("question/" + questionId + "/title")
- .then(res => console.log(res))
+ .then(res => setActiveQuestionName(res.data.title))
.catch(err => axiosError(err, alert));
}
}
@@ -168,13 +170,7 @@ export default function Dashboard(props: Props) {
boxShadow: "var(--box-shadow)"
} }
tabIndex={ 0 }>
-

{
- currentTarget.onerror = null; // prevents looping
- currentTarget.src = "https://www.gravatar.com/avatar/205e460b479e2e5b48aec07710c08d50";
- } }/>
+
}
items={ [
{
@@ -261,14 +257,21 @@ export default function Dashboard(props: Props) {
return