mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-02-02 17:25:22 +03:00
Add haptic feedback for modifications like deleting or favoriting an event
This commit is contained in:
parent
b6f799e641
commit
a3d1439ca6
@ -23,6 +23,7 @@ import Button from '../components/Button';
|
||||
import Dialog from '../components/Dialog';
|
||||
|
||||
const API_LIMIT = 25;
|
||||
const HAPTIC_FEEDBACK_DURATION = 100;
|
||||
|
||||
const daysAgo = (num) => {
|
||||
let date = new Date();
|
||||
@ -110,7 +111,14 @@ export default function Events({ path, ...props }) {
|
||||
);
|
||||
|
||||
const onSave = async (e, eventId, save) => {
|
||||
if (e) {
|
||||
e.stopPropagation();
|
||||
|
||||
if ("vibrate" in navigator) {
|
||||
navigator.vibrate(HAPTIC_FEEDBACK_DURATION);
|
||||
}
|
||||
}
|
||||
|
||||
let response;
|
||||
if (save) {
|
||||
response = await axios.post(`events/${eventId}/retain`);
|
||||
@ -123,8 +131,14 @@ export default function Events({ path, ...props }) {
|
||||
};
|
||||
|
||||
const onDelete = async (e, eventId, saved) => {
|
||||
if (e) {
|
||||
e.stopPropagation();
|
||||
|
||||
if ("vibrate" in navigator) {
|
||||
navigator.vibrate(HAPTIC_FEEDBACK_DURATION);
|
||||
}
|
||||
}
|
||||
|
||||
if (saved) {
|
||||
setDeleteFavoriteState({ deletingFavoriteEventId: eventId, showDeleteFavorite: true });
|
||||
} else {
|
||||
@ -140,7 +154,14 @@ export default function Events({ path, ...props }) {
|
||||
const downloadButton = useRef();
|
||||
|
||||
const onDownloadClick = (e, event) => {
|
||||
if (e) {
|
||||
e.stopPropagation();
|
||||
|
||||
if ("vibrate" in navigator) {
|
||||
navigator.vibrate(HAPTIC_FEEDBACK_DURATION);
|
||||
}
|
||||
}
|
||||
|
||||
setDownloadEvent((_prev) => ({
|
||||
id: event.id,
|
||||
has_clip: event.has_clip,
|
||||
@ -197,6 +218,10 @@ export default function Events({ path, ...props }) {
|
||||
|
||||
const onSendToPlus = async (id, e) => {
|
||||
if (e) {
|
||||
if ("vibrate" in navigator) {
|
||||
navigator.vibrate(HAPTIC_FEEDBACK_DURATION);
|
||||
}
|
||||
|
||||
e.stopPropagation();
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user