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';
|
import Dialog from '../components/Dialog';
|
||||||
|
|
||||||
const API_LIMIT = 25;
|
const API_LIMIT = 25;
|
||||||
|
const HAPTIC_FEEDBACK_DURATION = 100;
|
||||||
|
|
||||||
const daysAgo = (num) => {
|
const daysAgo = (num) => {
|
||||||
let date = new Date();
|
let date = new Date();
|
||||||
@ -110,7 +111,14 @@ export default function Events({ path, ...props }) {
|
|||||||
);
|
);
|
||||||
|
|
||||||
const onSave = async (e, eventId, save) => {
|
const onSave = async (e, eventId, save) => {
|
||||||
e.stopPropagation();
|
if (e) {
|
||||||
|
e.stopPropagation();
|
||||||
|
|
||||||
|
if ("vibrate" in navigator) {
|
||||||
|
navigator.vibrate(HAPTIC_FEEDBACK_DURATION);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
let response;
|
let response;
|
||||||
if (save) {
|
if (save) {
|
||||||
response = await axios.post(`events/${eventId}/retain`);
|
response = await axios.post(`events/${eventId}/retain`);
|
||||||
@ -123,7 +131,13 @@ export default function Events({ path, ...props }) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const onDelete = async (e, eventId, saved) => {
|
const onDelete = async (e, eventId, saved) => {
|
||||||
e.stopPropagation();
|
if (e) {
|
||||||
|
e.stopPropagation();
|
||||||
|
|
||||||
|
if ("vibrate" in navigator) {
|
||||||
|
navigator.vibrate(HAPTIC_FEEDBACK_DURATION);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (saved) {
|
if (saved) {
|
||||||
setDeleteFavoriteState({ deletingFavoriteEventId: eventId, showDeleteFavorite: true });
|
setDeleteFavoriteState({ deletingFavoriteEventId: eventId, showDeleteFavorite: true });
|
||||||
@ -140,7 +154,14 @@ export default function Events({ path, ...props }) {
|
|||||||
const downloadButton = useRef();
|
const downloadButton = useRef();
|
||||||
|
|
||||||
const onDownloadClick = (e, event) => {
|
const onDownloadClick = (e, event) => {
|
||||||
e.stopPropagation();
|
if (e) {
|
||||||
|
e.stopPropagation();
|
||||||
|
|
||||||
|
if ("vibrate" in navigator) {
|
||||||
|
navigator.vibrate(HAPTIC_FEEDBACK_DURATION);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
setDownloadEvent((_prev) => ({
|
setDownloadEvent((_prev) => ({
|
||||||
id: event.id,
|
id: event.id,
|
||||||
has_clip: event.has_clip,
|
has_clip: event.has_clip,
|
||||||
@ -197,6 +218,10 @@ export default function Events({ path, ...props }) {
|
|||||||
|
|
||||||
const onSendToPlus = async (id, e) => {
|
const onSendToPlus = async (id, e) => {
|
||||||
if (e) {
|
if (e) {
|
||||||
|
if ("vibrate" in navigator) {
|
||||||
|
navigator.vibrate(HAPTIC_FEEDBACK_DURATION);
|
||||||
|
}
|
||||||
|
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user