Skip to content

DeepTeam is a framework to red team LLMs and AI agents.

update all pages from js to ts

A-Vamshi61c918322795
diff --git a/docs/src/pages/blog.js b/docs/src/pages/blog.tsx
similarity index 86%
rename from docs/src/pages/blog.js
rename to docs/src/pages/blog.tsx
index 15b34b37..1d672c7f 100644
--- a/docs/src/pages/blog.js
+++ b/docs/src/pages/blog.tsx
@@ -1,13 +1,40 @@
-import React from "react";
+import React, { type ReactNode } from "react";
import styles from "./blog.module.css";
import LayoutProvider from "@theme/Layout/Provider";
import Footer from "@theme/Footer";
import Navbar from "@theme/Navbar";
import Link from "@docusaurus/Link";
+interface AuthorData {
+ name: string;
+ title: string;
+ url: string;
+ image_url: string;
+}
+
+interface AuthorsMap {
+ [key: string]: AuthorData;
+}
+
+interface Blog {
+ title: string;
+ description: string;
+ slug: string;
+ authors: string[];
+ date: string;
+}
+
+interface BlogCardProps {
+ title: string;
+ description: string;
+ date: string;
+ authors: string[];
+ slug: string;
+ authorsData: AuthorsMap;
+}
-class BlogCard extends React.Component {
- formatDate(dateString) {
+class BlogCard extends React.Component<BlogCardProps> {
+ formatDate(dateString: string): string {
const date = new Date(dateString);
return date.toLocaleDateString('en-US', {
year: 'numeric',
@@ -16,16 +43,7 @@ class BlogCard extends React.Component {
});
}
- formatAuthors(authors, authorsData) {
- if (!authors || authors.length === 0) return 'Anonymous';
-
- return authors.map(authorKey => {
- const author = authorsData[authorKey];
- return author ? author.name : authorKey;
- }).join(', ');
- }
-
- renderAuthors(authors, authorsData) {
+ renderAuthors(authors: string[], authorsData: AuthorsMap): ReactNode {
if (!authors || authors.length === 0) {
return <span className={styles.author}>Anonymous</span>;
}
@@ -49,7 +67,7 @@ class BlogCard extends React.Component {
});
}
- render() {
+ render(): ReactNode {
const { title, description, date, authors, slug, authorsData } = this.props;
const blogUrl = `/blog/${slug}`;
@@ -74,8 +92,15 @@ class BlogCard extends React.Component {
}
}
-class Index extends React.Component {
- constructor(props) {
+interface IndexState {
+ blogs: Blog[];
+ authors: AuthorsMap;
+ loading: boolean;
+ error: string | null;
+}
+
+class Index extends React.Component<Record<string, unknown>, IndexState> {
+ constructor(props: Record<string, unknown>) {
super(props);
this.state = {
blogs: [],
@@ -85,10 +110,9 @@ class Index extends React.Component {
};
}
- async componentDidMount() {
+ async componentDidMount(): Promise<void> {
try {
- // Simulate loading blog data (in a real app, this would be from a CMS or markdown files)
- const blogData = [
+ const blogData: Blog[] = [
{
title: "Breaking Gemini 2.5 Pro using DeepTeam",
description: "An in-depth analysis of Gemini 2.5 Pro's vulnerabilities using DeepTeam, revealing how different attack strategies can bypass AI safety measures",
@@ -126,7 +150,7 @@ class Index extends React.Component {
}
];
- const authorsData = {
+ const authorsData: AuthorsMap = {
penguine: {
name: "Penguine",
title: "DeepTeam Wizard",
@@ -147,8 +171,7 @@ class Index extends React.Component {
}
};
- // Sort blogs by date (newest first)
- const sortedBlogs = blogData.sort((a, b) => new Date(b.date) - new Date(a.date));
+ const sortedBlogs = blogData.sort((a, b) => new Date(b.date).getTime() - new Date(a.date).getTime());
this.setState({
blogs: sortedBlogs,
@@ -163,7 +186,7 @@ class Index extends React.Component {
}
}
- render() {
+ render(): ReactNode {
const { blogs, authors, loading, error } = this.state;
return (
@@ -226,7 +249,7 @@ class Index extends React.Component {
}
}
-export default function (props) {
+export default function BlogHome(props: Record<string, unknown>): ReactNode {
return (
<LayoutProvider>
<Navbar />
diff --git a/docs/src/pages/index.js b/docs/src/pages/index.tsx
similarity index 93%
rename from docs/src/pages/index.js
rename to docs/src/pages/index.tsx
index 88d7e98c..168173cd 100644
--- a/docs/src/pages/index.js
+++ b/docs/src/pages/index.tsx
@@ -1,4 +1,4 @@
-import React from 'react';
+import React, { ReactNode } from 'react';
import styles from './index.module.css';
import LayoutProvider from '@theme/Layout/Provider';
import Footer from '@theme/Footer';
@@ -36,7 +36,7 @@ class ConfidentEnvelope extends React.Component {
<div className={styles.letterContentContainer}>
<img src="icons/red-logo.svg" style={{width: "30px", height: "30px"}}/>
<div className={styles.letterContext}>
- <span class="lexend-deca" style={{fontSize: "16px"}}>Confident AI</span>
+ <span className="lexend-deca" style={{fontSize: "16px"}}>Confident AI</span>
</div>
</div>
<div className={styles.letterStamp}>
@@ -54,7 +54,13 @@ class ConfidentEnvelope extends React.Component {
}
}
-class FeatureCard extends React.Component {
+interface FeatureCardProps {
+ title: string;
+ link: string;
+ description: string;
+}
+
+class FeatureCard extends React.Component<FeatureCardProps> {
render() {
const { title, link, description } = this.props;
@@ -69,7 +75,6 @@ class FeatureCard extends React.Component {
}
}
-
class Index extends React.Component {
handleConfident = () => {
window.open('https://confident-ai.com', '_blank');
@@ -116,9 +121,7 @@ class Index extends React.Component {
}
}
-
-
-export default function (props) {
+export default function Home(props: any): ReactNode {
return <LayoutProvider>
<div className={styles.mainRapper}>
<div className={styles.rapper}>