-
Notifications
You must be signed in to change notification settings - Fork 3
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
Showing
8 changed files
with
100 additions
and
14 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
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,42 @@ | ||
import {Feature, FeatureName} from "../service/api"; | ||
import { | ||
Stack, | ||
Typography | ||
} from "@mui/material"; | ||
import React from "react"; | ||
import {DiscordChannel} from "./DiscordChannel"; | ||
import {FeatureDataTable} from "./FeatureDataTable"; | ||
|
||
function getCustomizedElement(feature: Feature, guildId: string) { | ||
switch (feature.name) { | ||
case FeatureName.poopName: | ||
case FeatureName.mentions: | ||
return <Typography>No data.</Typography>; | ||
case FeatureName.joinLogs: | ||
case FeatureName.modLogs: | ||
return <FeatureDataTable data={{"Target channel": <DiscordChannel guildId={guildId} channelId={feature.data.value} />}} />; | ||
case FeatureName.jellyfin: | ||
case FeatureName.kavita: | ||
return <FeatureDataTable data={{"Create instance channel": feature.data.create_instance_role}} />; | ||
case FeatureName.emojiReact: | ||
return <FeatureDataTable data={{ | ||
"Use builtin": feature.data.use_builtin.toString(), | ||
"Mode": feature.data.mode.toString(), | ||
"Process other bots messages": feature.data.process_other_bots.toString(), | ||
}} />; | ||
default: | ||
return <Typography>Cannot render feature data (type: {feature.name})</Typography>; | ||
} | ||
} | ||
|
||
export interface FeatureData { | ||
feature: Feature, | ||
guildId: string | ||
} | ||
|
||
export function FeatureData({feature, guildId}: FeatureData) { | ||
return <Stack direction="column"> | ||
<Typography fontWeight="bold">Data: </Typography> | ||
<Typography>{getCustomizedElement(feature, guildId)}</Typography> | ||
</Stack> | ||
} |
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,29 @@ | ||
import {Paper, Table, TableBody, TableCell, TableContainer, TableHead, TableRow} from "@mui/material"; | ||
import React from "react"; | ||
|
||
export interface FeatureDataTableProps { | ||
data: Record<string, any> | ||
} | ||
|
||
export function FeatureDataTable({data}: FeatureDataTableProps) { | ||
const headers = []; | ||
const cells = []; | ||
|
||
for (const [key, value] of Object.entries(data)) { | ||
headers.push(<TableCell align="left">{key}</TableCell>); | ||
cells.push(<TableCell align="left">{value}</TableCell>); | ||
} | ||
|
||
return <TableContainer component={Paper}> | ||
<Table> | ||
<TableHead> | ||
<TableRow> | ||
{headers} | ||
</TableRow> | ||
</TableHead> | ||
<TableBody> | ||
<TableRow>{cells}</TableRow> | ||
</TableBody> | ||
</Table> | ||
</TableContainer>; | ||
} |
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
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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"compilerOptions": { | ||
"target": "es5", | ||
"target": "es2015", | ||
"lib": [ | ||
"dom", | ||
"dom.iterable", | ||
|