Skip to content

Commit

Permalink
Merge pull request #153 from keploy/fix-hydration-issue
Browse files Browse the repository at this point in the history
fix: hydration issues
  • Loading branch information
Hermione2408 authored Dec 9, 2024
2 parents 938db9b + dc1bd72 commit b83c98c
Show file tree
Hide file tree
Showing 25 changed files with 698 additions and 666 deletions.
6 changes: 3 additions & 3 deletions app/(default)/case-studies/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,9 @@ export default function Home() {
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
strokeWidth="2"
strokeLinecap="round"
strokeLinejoin="round"
>
<path d="m9 18 6-6-6-6" />
</svg>
Expand Down
4 changes: 2 additions & 2 deletions app/(default)/webstories/css/CircularLoader.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@
.backgroundCircle {
fill: none;
stroke: #e2a26d;
stroke-width: 10;
strokeWidth: 10;
}

.progressCircle {
fill: none;
stroke: #d84f06;
stroke-width: 10;
strokeWidth: 10;
stroke-dasharray: 283; /* 2 * Math.PI * 45 (radius) */
stroke-dashoffset: 283; /* Initially hidden */
transition: stroke-dashoffset 0.3s linear;
Expand Down
202 changes: 118 additions & 84 deletions app/layout.tsx

Large diffs are not rendered by default.

303 changes: 141 additions & 162 deletions components/FeatureMoblieView.tsx

Large diffs are not rendered by default.

22 changes: 12 additions & 10 deletions components/Particles.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,8 @@ interface MousePosition {
y: number;
}

function MousePosition(): MousePosition {
const [mousePosition, setMousePosition] = useState<MousePosition>({
x: 0,
y: 0,
});
function useMousePosition(): MousePosition {
const [mousePosition, setMousePosition] = useState<MousePosition>({ x: 0, y: 0 });

useEffect(() => {
const handleMouseMove = (event: MouseEvent) => {
Expand Down Expand Up @@ -71,10 +68,15 @@ const Particles: React.FC<ParticlesProps> = ({
const canvasContainerRef = useRef<HTMLDivElement>(null);
const context = useRef<CanvasRenderingContext2D | null>(null);
const circles = useRef<any[]>([]);
const mousePosition = MousePosition();
const mousePosition = useMousePosition();
const mouse = useRef<{ x: number; y: number }>({ x: 0, y: 0 });
const canvasSize = useRef<{ w: number; h: number }>({ w: 0, h: 0 });
const dpr = typeof window !== "undefined" ? window.devicePixelRatio : 1;

// Defer devicePixelRatio calculation to client
const [dpr, setDpr] = useState(1);
useEffect(() => {
setDpr(window.devicePixelRatio);
}, []);

useEffect(() => {
if (canvasRef.current) {
Expand All @@ -87,7 +89,7 @@ const Particles: React.FC<ParticlesProps> = ({
return () => {
window.removeEventListener("resize", initCanvas);
};
}, [color]);
}, [color, dpr]);

useEffect(() => {
onMouseMove();
Expand Down Expand Up @@ -116,7 +118,7 @@ const Particles: React.FC<ParticlesProps> = ({
}
};

interface Circle {
interface Circle {
x: number;
y: number;
translateX: number;
Expand All @@ -127,7 +129,7 @@ const Particles: React.FC<ParticlesProps> = ({
dx: number;
dy: number;
magnetism: number;
};
}

const resizeCanvas = () => {
if (canvasContainerRef.current && canvasRef.current && context.current) {
Expand Down
2 changes: 1 addition & 1 deletion components/atg/terminal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,7 @@ function CombinedTerminalPage({
promptLabel={
<p className="font-bold flex">
{Emoji}
<p className="text-accent-100">~/$</p>
<span className="text-accent-100">~/$</span>
</p>
}
commands={commands}
Expand Down
6 changes: 3 additions & 3 deletions components/caseStudyCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ export default function CaseStudyCard({
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
strokeWidth="2"
strokeLinecap="round"
strokeLinejoin="round"
>
<path d="m9 18 6-6-6-6" />
</svg>
Expand Down
6 changes: 3 additions & 3 deletions components/caseStudySearch.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ export default function CaseStudySearch({setSearch}: caseStudySearchProps) {
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
strokeWidth="2"
strokeLinecap="round"
strokeLinejoin="round"
>
<circle cx="11" cy="11" r="8" />
<path d="m21 21-4.3-4.3" />
Expand Down
8 changes: 4 additions & 4 deletions components/nav/UpIcon.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export const UpIcon = ({ className }) => (
<svg className={className} height="12px" width="12px" viewBox="0 0 407.436 407.436" xmlns="http://www.w3.org/2000/svg">
<polygon fill="currentColor" points="203.718,91.567 0,294.621 21.179,315.869 203.718,133.924 386.258,315.869 407.436,294.621" />
</svg>
);
<svg className={className} height="12px" width="12px" viewBox="0 0 407.436 407.436" xmlns="http://www.w3.org/2000/svg">
<polygon fill="currentColor" points="203.718,91.567 0,294.621 21.179,315.869 203.718,133.924 386.258,315.869 407.436,294.621" />
</svg>
);
4 changes: 3 additions & 1 deletion components/nav/solutionsSection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,9 @@ export default function Solutions() {
href={item.url}
className="flex items-center gap-3 font-semibold hover:text-primary-500 transition-colors duration-200 h-[24px]"
>
<div className="h-6 w-6 flex-shrink-0 flex items-center justify-center">{item.icon}</div>
<div className="h-6 w-6 flex-shrink-0 flex items-center justify-center">
{item.icon}
</div>
<span>{item.name}</span>
</a>
</li>
Expand Down
2 changes: 1 addition & 1 deletion components/webstories/Stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ const Stories = ({
};

const handleSwipeUp = () => {
window.location.href = "/webstories";
router.push("/webstories");
};

const handleLongPress = () => {
Expand Down
Loading

0 comments on commit b83c98c

Please sign in to comment.