Add comment field that is shown on account hover. Update discord link
This commit is contained in:
@@ -16,9 +16,11 @@ export const CharacterDialog = ({
|
|||||||
updateCharacter: (characer: AccessToken, update: CharacterUpdate) => void;
|
updateCharacter: (characer: AccessToken, update: CharacterUpdate) => void;
|
||||||
}) => {
|
}) => {
|
||||||
const [account, setAccount] = useState("");
|
const [account, setAccount] = useState("");
|
||||||
|
const [comment, setComment] = useState("");
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (character?.account) setAccount(character.account);
|
if (character?.account) setAccount(character.account);
|
||||||
|
if (character?.comment) setComment(character.comment);
|
||||||
}, [character]);
|
}, [character]);
|
||||||
|
|
||||||
const logout = (character: AccessToken) => {
|
const logout = (character: AccessToken) => {
|
||||||
@@ -29,8 +31,8 @@ export const CharacterDialog = ({
|
|||||||
|
|
||||||
const handleKeyDown = (event: KeyboardEvent<HTMLDivElement>) => {
|
const handleKeyDown = (event: KeyboardEvent<HTMLDivElement>) => {
|
||||||
if (event.key === "Enter") {
|
if (event.key === "Enter") {
|
||||||
character && updateCharacter(character, { account });
|
|
||||||
closeDialog();
|
closeDialog();
|
||||||
|
character && updateCharacter(character, { account, comment });
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -46,10 +48,20 @@ export const CharacterDialog = ({
|
|||||||
onChange={(event) => setAccount(event.target.value)}
|
onChange={(event) => setAccount(event.target.value)}
|
||||||
onKeyDown={handleKeyDown}
|
onKeyDown={handleKeyDown}
|
||||||
/>
|
/>
|
||||||
|
<TextField
|
||||||
|
id="outlined-basic"
|
||||||
|
label="Comment"
|
||||||
|
variant="outlined"
|
||||||
|
value={comment ?? ""}
|
||||||
|
sx={{ margin: 1 }}
|
||||||
|
multiline={true}
|
||||||
|
onChange={(event) => setComment(event.target.value)}
|
||||||
|
onKeyDown={handleKeyDown}
|
||||||
|
/>
|
||||||
<DialogActions>
|
<DialogActions>
|
||||||
<Button
|
<Button
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
character && updateCharacter(character, { account });
|
character && updateCharacter(character, { account, comment });
|
||||||
closeDialog();
|
closeDialog();
|
||||||
}}
|
}}
|
||||||
variant="contained"
|
variant="contained"
|
||||||
|
@@ -7,7 +7,7 @@ import { styled, useTheme } from "@mui/material/styles";
|
|||||||
import React from "react";
|
import React from "react";
|
||||||
import { CharacterDialog } from "./CharacterDialog";
|
import { CharacterDialog } from "./CharacterDialog";
|
||||||
import { AccessToken } from "@/types";
|
import { AccessToken } from "@/types";
|
||||||
import { Box, Button } from "@mui/material";
|
import { Box, Button, Tooltip } from "@mui/material";
|
||||||
import { EVE_IMAGE_URL } from "@/const";
|
import { EVE_IMAGE_URL } from "@/const";
|
||||||
import { CharacterContext } from "@/app/context/Context";
|
import { CharacterContext } from "@/app/context/Context";
|
||||||
|
|
||||||
@@ -38,6 +38,7 @@ export const CharacterRow = ({ character }: { character: AccessToken }) => {
|
|||||||
updateCharacter={updateCharacter}
|
updateCharacter={updateCharacter}
|
||||||
closeDialog={() => setSelectedCharacter(undefined)}
|
closeDialog={() => setSelectedCharacter(undefined)}
|
||||||
/>
|
/>
|
||||||
|
<Tooltip title={character.comment}>
|
||||||
<Box
|
<Box
|
||||||
display="flex"
|
display="flex"
|
||||||
flexDirection="column"
|
flexDirection="column"
|
||||||
@@ -62,6 +63,7 @@ export const CharacterRow = ({ character }: { character: AccessToken }) => {
|
|||||||
{character.character.name}
|
{character.character.name}
|
||||||
</Button>
|
</Button>
|
||||||
</Box>
|
</Box>
|
||||||
|
</Tooltip>
|
||||||
</StackItem>
|
</StackItem>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
@@ -4,7 +4,7 @@ export const DiscordButton = () => {
|
|||||||
<Box>
|
<Box>
|
||||||
<Tooltip title="Come nerd out in discord about PI and this tool">
|
<Tooltip title="Come nerd out in discord about PI and this tool">
|
||||||
<Button
|
<Button
|
||||||
href="https://discord.gg/MDapvGyw"
|
href="https://discord.gg/qQK7vu3y9"
|
||||||
target="_blank"
|
target="_blank"
|
||||||
style={{ width: "100%" }}
|
style={{ width: "100%" }}
|
||||||
sx={{ color: "white", display: "block" }}
|
sx={{ color: "white", display: "block" }}
|
||||||
|
@@ -42,6 +42,7 @@ const Home = () => {
|
|||||||
return {
|
return {
|
||||||
...c,
|
...c,
|
||||||
...(updates.account ? { account: updates.account } : {}),
|
...(updates.account ? { account: updates.account } : {}),
|
||||||
|
...(updates.comment ? { comment: updates.comment } : {}),
|
||||||
};
|
};
|
||||||
return c;
|
return c;
|
||||||
});
|
});
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
import { AccessToken } from "@/types";
|
import { AccessToken } from "@/types";
|
||||||
import { extractCharacterFromToken } from "@/utils";
|
import { extractCharacterFromToken } from "@/utils";
|
||||||
import { NextApiRequest, NextApiResponse } from "next";
|
|
||||||
import crypto from "crypto-js";
|
import crypto from "crypto-js";
|
||||||
|
import { NextApiRequest, NextApiResponse } from "next";
|
||||||
|
|
||||||
const EVE_SSO_TOKEN_URL = "https://login.eveonline.com/v2/oauth/token";
|
const EVE_SSO_TOKEN_URL = "https://login.eveonline.com/v2/oauth/token";
|
||||||
const EVE_SSO_CLIENT_ID = process.env.EVE_SSO_CLIENT_ID ?? "";
|
const EVE_SSO_CLIENT_ID = process.env.EVE_SSO_CLIENT_ID ?? "";
|
||||||
@@ -46,6 +46,7 @@ const handler = async (req: NextApiRequest, res: NextApiResponse) => {
|
|||||||
character,
|
character,
|
||||||
needsLogin: false,
|
needsLogin: false,
|
||||||
account: accessToken.account,
|
account: accessToken.account,
|
||||||
|
comment: accessToken.comment
|
||||||
};
|
};
|
||||||
|
|
||||||
console.log("Refresh", character.name, character.characterId);
|
console.log("Refresh", character.name, character.characterId);
|
||||||
|
@@ -47,6 +47,7 @@ const handler = async (req: NextApiRequest, res: NextApiResponse) => {
|
|||||||
character,
|
character,
|
||||||
needsLogin: false,
|
needsLogin: false,
|
||||||
account: "-",
|
account: "-",
|
||||||
|
comment: "",
|
||||||
};
|
};
|
||||||
res.json(token);
|
res.json(token);
|
||||||
} else {
|
} else {
|
||||||
|
@@ -8,6 +8,7 @@ export interface AccessToken {
|
|||||||
character: Character;
|
character: Character;
|
||||||
account: string;
|
account: string;
|
||||||
needsLogin: boolean;
|
needsLogin: boolean;
|
||||||
|
comment: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface Character {
|
export interface Character {
|
||||||
@@ -28,6 +29,7 @@ export interface CharacterPlanets {
|
|||||||
|
|
||||||
export interface CharacterUpdate {
|
export interface CharacterUpdate {
|
||||||
account?: string;
|
account?: string;
|
||||||
|
comment?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export type Planet = EsiType<"v1", "getCharactersCharacterIdPlanets">[number];
|
export type Planet = EsiType<"v1", "getCharactersCharacterIdPlanets">[number];
|
||||||
|
Reference in New Issue
Block a user