-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8246dda
commit 2b68b6c
Showing
6 changed files
with
550 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
import React, { useState } from "react"; | ||
import { Input, Checkbox, Typography, Row, Col } from "antd"; | ||
import "../../styles/ExiftoolOverviewCard.css" | ||
|
||
const { Text } = Typography; | ||
|
||
const VbOverviewCard = ({ data }) => { | ||
const [filter, setFilter] = useState(""); | ||
const [wrapText, setWrapText] = useState(false); | ||
const [trimText, setTrimText] = useState(true); | ||
|
||
// Function to process VB script data for display | ||
const processVbData = (key) => { | ||
return data.scan.vb[key] | ||
.filter((value) => { | ||
const searchTerm = filter.toLowerCase(); | ||
return !filter || value.toLowerCase().includes(searchTerm); | ||
}) | ||
.map((value, index) => { | ||
let processedValue = value; | ||
if (trimText && typeof processedValue === "string") { | ||
processedValue = processedValue.trim(); | ||
} | ||
if (!wrapText) { | ||
processedValue = typeof processedValue === "string" ? processedValue.replace(/\s+/g, " ") : processedValue; | ||
} | ||
return { line: index + 1, value: processedValue }; | ||
}); | ||
}; | ||
|
||
const renderVbSection = (title, key) => { | ||
const vbData = processVbData(key); | ||
return ( | ||
<div | ||
className="exif-data-list" | ||
style={{ maxHeight: "400px", overflow: "auto" }} | ||
> | ||
<Text strong style={{ fontSize: "14px", marginBottom: "10px" }}>{title}</Text> | ||
{vbData.map(({ line, label, value }) => ( | ||
<Row key={line} className="exif-data-row"> | ||
<Col span={1} className="line-number"> | ||
<div style={{ fontSize: "12px" }}>{line}</div> | ||
</Col> | ||
<Col span={22} className="exif-data-value"> | ||
<Text code copyable style={{ fontSize: "12px" }}> | ||
{typeof value === "string" ? value : JSON.stringify(value)} | ||
</Text> | ||
</Col> | ||
</Row> | ||
))} | ||
</div> | ||
); | ||
}; | ||
|
||
return ( | ||
<div className="vb-overview"> | ||
<Row gutter={[16, 16]}> | ||
<Col span={18}> | ||
<Input placeholder="Filter" onChange={(e) => setFilter(e.target.value)} style={{ width: "100%" }} /> | ||
</Col> | ||
<Col span={6}> | ||
<Checkbox checked={wrapText} onChange={(e) => setWrapText(e.target.checked)}>Wrap</Checkbox> | ||
<Checkbox checked={trimText} onChange={(e) => setTrimText(e.target.checked)}>Trim</Checkbox> | ||
</Col> | ||
</Row> | ||
|
||
{renderVbSection("Tokens", "tokens")} | ||
{renderVbSection("Comments", "comments")} | ||
{renderVbSection("Functions", "functions")} | ||
{renderVbSection("Names", "names")} | ||
{renderVbSection("Operators", "operators")} | ||
{renderVbSection("Strings", "strings")} | ||
</div> | ||
); | ||
}; | ||
|
||
export default VbOverviewCard; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.