Skip to content

Commit

Permalink
com: Add json formatting to the packages
Browse files Browse the repository at this point in the history
  • Loading branch information
Core447 committed Jan 28, 2025
1 parent 9b34fd3 commit e0dbc69
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 4 deletions.
17 changes: 14 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"peerjs": "^1.5.4",
"react": "^18",
"react-dom": "^18",
"react-json-pretty": "^2.2.0",
"tailwind-merge": "^2.6.0",
"tailwindcss-animate": "^1.0.7",
"unique-names-generator": "^4.7.1"
Expand Down
8 changes: 7 additions & 1 deletion src/app/com/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ import { DataConnection, Peer } from "peerjs";
import { useCallback, useEffect, useMemo, useState, useRef } from "react";
import { adjectives, animals, colors, uniqueNamesGenerator } from "unique-names-generator";
import { useQuery } from "@tanstack/react-query";
import JSONPretty from 'react-json-pretty';
import 'react-json-pretty/themes/monikai.css';



interface Data {
}
Expand Down Expand Up @@ -199,7 +203,9 @@ export default function Page() {
{receivedPackages.slice(-5).map((packet, index) => (
<div key={index} className="p-2 border rounded mb-2">
<p>From: {packet.sender}</p>
<p>Message: {JSON.stringify(packet)}</p>
{/* <p>Message: {JSON.stringify(packet)}</p> */}
<JSONPretty id="json-pretty" data={packet}></JSONPretty>

</div>
))}
</div>
Expand Down

0 comments on commit e0dbc69

Please sign in to comment.