Skip to content

Commit

Permalink
fix: fix modify coordinates and selfsign
Browse files Browse the repository at this point in the history
  • Loading branch information
chowjustin committed Nov 11, 2024
1 parent b9f6537 commit 390ef69
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
7 changes: 5 additions & 2 deletions src/app/dashboard/[id]/modal/editModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,15 @@ export function EditModal({
);
const [isMdScreen, setIsMdScreen] = useState(false);
const animationFrameId = useRef<number | null>(null);
const [screenSize, setScreenSize] = useState(1440);

useEffect(() => {
const handleResize = () => {
setIsMdScreen(window.innerWidth >= 768);
};

setScreenSize(window.innerWidth);

window.addEventListener("resize", handleResize);
handleResize();

Expand Down Expand Up @@ -195,8 +198,8 @@ export function EditModal({

const rect = page.getBoundingClientRect();

const scaleX = 595 / rect.width;
const scaleY = 842 / rect.height;
const scaleX = 595 / (screenSize >= 768 ? 227 : rect.width);
const scaleY = 842 / (screenSize >= 768 ? 322 : rect.height);

const scaledX = selection.x * scaleX;
const scaledY = selection.y * scaleY;
Expand Down
9 changes: 7 additions & 2 deletions src/components/form/SelectableInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { useQuery } from "@tanstack/react-query";
import React, { useState, useEffect, useRef } from "react";
import { useFormContext } from "react-hook-form";
import ErrorMessage from "./ErrorMessage";
import useAuthStore from "@/app/stores/useAuthStore";

export type SelectableInputProps = {
id: string;
Expand All @@ -27,6 +28,8 @@ const SelectableInput: React.FC<SelectableInputProps> = ({
const [searchTerm, setSearchTerm] = useState<string>("");
const dropdownRef = useRef<HTMLDivElement>(null);

const { user } = useAuthStore();

const {
register,
setValue,
Expand All @@ -41,8 +44,10 @@ const SelectableInput: React.FC<SelectableInputProps> = ({
},
});

const filteredData = data?.filter((item: string) =>
item.toLowerCase().includes(searchTerm.toLowerCase()),
const filteredData = data?.filter(
(item: string) =>
item.toLowerCase().includes(searchTerm.toLowerCase()) &&
item.toLowerCase() !== user?.username.toLowerCase(),
);

useEffect(() => {
Expand Down

0 comments on commit 390ef69

Please sign in to comment.