feat: add reset button
This commit is contained in:
parent
cc350e4bf2
commit
4f3716b641
@ -1,12 +1,13 @@
|
|||||||
import DiscTooltip from "./DiscTooltip"
|
import DiscTooltip from "./DiscTooltip"
|
||||||
import { selectDiscs, useAppSelector } from "../store"
|
import { selectDiscs, useAppDispatch, useAppSelector } from "../store"
|
||||||
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"
|
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"
|
||||||
import { solid } from "@fortawesome/fontawesome-svg-core/import.macro"
|
import { solid } from "@fortawesome/fontawesome-svg-core/import.macro"
|
||||||
import ReactTooltip from "react-tooltip"
|
import ReactTooltip from "react-tooltip"
|
||||||
import EditNameModal from "./EditNameModal"
|
import EditNameModal from "./EditNameModal"
|
||||||
|
import { setDescription, setTitle } from "../store/discs"
|
||||||
|
import { useState } from "react"
|
||||||
|
|
||||||
import "./DiscRow.css"
|
import "./DiscRow.css"
|
||||||
import { useState } from "react"
|
|
||||||
|
|
||||||
interface DiscRowProps {
|
interface DiscRowProps {
|
||||||
discId: number
|
discId: number
|
||||||
@ -18,9 +19,15 @@ function DiscRow({ discId }: DiscRowProps) {
|
|||||||
|
|
||||||
const [showEditName, setShowEditName] = useState(false);
|
const [showEditName, setShowEditName] = useState(false);
|
||||||
|
|
||||||
|
const dispatch = useAppDispatch()
|
||||||
|
function onReset() {
|
||||||
|
dispatch(setTitle({ id: discId, title: "" }))
|
||||||
|
dispatch(setDescription({ id: discId, description: "" }))
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="disc-row">
|
<div className="disc-row">
|
||||||
<button data-tip="Reset">
|
<button data-tip="Reset" onClick={onReset}>
|
||||||
<FontAwesomeIcon icon={solid("arrow-rotate-right")} />
|
<FontAwesomeIcon icon={solid("arrow-rotate-right")} />
|
||||||
</button>
|
</button>
|
||||||
<button data-tip="Edit name" onClick={() => setShowEditName(true)}>
|
<button data-tip="Edit name" onClick={() => setShowEditName(true)}>
|
||||||
|
Loading…
Reference in New Issue
Block a user