Skip to content

Commit

Permalink
🧟‍♂️🦤 ↝ [SSG-95]: I hate linting
Browse files Browse the repository at this point in the history
  • Loading branch information
Gizmotronn committed Jan 9, 2025
1 parent 3369f4b commit 4a188f0
Show file tree
Hide file tree
Showing 6 changed files with 3,151 additions and 3,182 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ export default function AsteroidViewer({ classificationConfig, classificationId

return (
<div className="w-full h-screen bg-black">
<Canvas camera={{ position: [0, 0, 4] }}>
{/* <Canvas camera={{ position: [0, 0, 4] }} children={<Background />} /> */}
<Background />
<Asteroid metallic={metallic} />
<OrbitControls enableZoom={false} autoRotate autoRotateSpeed={1} />
</Canvas>
{/* </Canvas> */}
<div className="absolute bottom-8 left-1/2 -translate-x-1/2 w-64 bg-black/50 p-4 rounded-lg">
<label htmlFor="material-slider" className="text-white text-sm mb-2 block">Material Type</label>
<Slider
Expand Down
33 changes: 3 additions & 30 deletions content/Posts/PostSingle.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ import { ThumbsUp, MessageSquare, Share2 } from "lucide-react";
import { Badge } from "@/components/ui/badge";
import { useSession, useSupabaseClient } from "@supabase/auth-helpers-react";
import { CommentCard } from "../Comments/CommentSingle";
import canvasToImage from 'canvas-to-image';
import html2canvas from 'html2canvas';

interface CommentProps {
id: number;
Expand Down Expand Up @@ -63,36 +61,11 @@ export function PostCardSingle({
const [voteCount, setVoteCount] = useState(votes);
const [newComment, setNewComment] = useState<string>("");
const [commentInputs, setCommentInputs] = useState<Record<number, string>>({});
const [isSharing, setIsSharing] = useState(false);
const shareCardRef = useRef<HTMLDivElement>(null);

useEffect(() => {
fetchComments();
}, [classificationId]);

const handleShare = async () => {
if (typeof window === "undefined" || !shareCardRef.current) return;
setIsSharing(true);

try {
const canvas = await html2canvas(shareCardRef.current, {
backgroundColor: "#ffffff",
scale: 2,
useCORS: true,
});

canvasToImage(canvas, {
name: `${title.toLowerCase().replace(/\s+/g, "-")}-share`,
type: "png",
quality: 1.0,
});
} catch (error) {
console.error("Error sharing post:", error);
} finally {
setIsSharing(false);
}
};

const fetchComments = async () => {
setLoadingComments(true);
try {
Expand Down Expand Up @@ -196,7 +169,7 @@ export function PostCardSingle({
return (
<>
<Card className="w-full max-w-2xl mx-auto my-8 bg-card text-card-foreground border-primary">
<div ref={shareCardRef}>
<div>
<CardHeader>
<div className="flex items-center space-x-4">
<Avatar>
Expand Down Expand Up @@ -228,15 +201,15 @@ export function PostCardSingle({
<MessageSquare className="mr-2" /> {comments.length}
</Button>
</div>
<Button
{/* <Button
onClick={handleShare}
size="sm"
disabled={isSharing}
variant="outline"
>
<Share2 className="mr-2" />
{isSharing ? 'Sharing...' : 'Share'}
</Button>
</Button> */}
</CardFooter>
{commentStatus !== false && (
<CardContent>
Expand Down
3 changes: 0 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,18 +46,15 @@
"antd-style": "^3.6.2",
"autoprefixer": "10.4.15",
"axios": "^1.6.8",
"canvas-to-image": "^2.2.5",
"class-variance-authority": "^0.7.0",
"clsx": "^2.1.1",
"d3": "^7.9.0",
"daisyui": "^4.11.1",
"date-fns": "^3.6.0",
"dom-to-image": "^2.6.0",
"embla-carousel-react": "^8.3.0",
"eslint": "8.49.0",
"eslint-config-next": "^15.0.0-rc.0",
"framer-motion": "^11.12.0",
"html-to-image": "^1.11.11",
"html2canvas": "^1.4.1",
"input-otp": "^1.2.4",
"konva": "^9.3.3",
Expand Down
18 changes: 10 additions & 8 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,11 @@
"lib": [
"dom",
"dom.iterable",
"esnext",
"esnext"
],
"allowJs": true,
"noImplicitAny": true,
"skipLibCheck": true,
"strict": true,
"noEmit": true,
"esModuleInterop": true,
"module": "esnext",
"moduleResolution": "bundler",
"resolveJsonModule": true,
Expand All @@ -27,17 +24,22 @@
"name": "next"
}
],
"target": "ES2017"
"target": "ES2017",
"skipLibCheck": true,
"esModuleInterop": true
},
"include": [
"next-env.d.ts",
"**/*.ts",
"**/*.tsx",
".next/types/**/*.ts",
"app/components/_[archive]/Classifications/Zoodex/CapturePage.jsx",
"app/components/_[archive]/Classifications/Zoodex/Mobx.jsx"
, "components/topographic-map.jsx", "components/enhanced-weather-events.jsx" ],
"app/components/_[archive]/Classifications/Zoodex/Mobx.jsx",
"components/topographic-map.jsx",
"components/enhanced-weather-events.jsx",
],
"exclude": [
"node_modules"
"node_modules",
"app/components/Data/Generator/Astronomer/DailyMinorPlanet.tsx"
]
}
10 changes: 0 additions & 10 deletions types/canvas-to-image.ts

This file was deleted.

Loading

0 comments on commit 4a188f0

Please sign in to comment.