import { Controller } from "@hotwired/stimulus"
import { NotificationsApi } from "notifications_api"
export default class extends Controller {
static targets = ["notification"]
static values = {
module TimeAgoHelper
def time_ago_tag(time, locale: I18n.locale, **options)
return if time.blank?
time = time.to_time
fallback = l(time, format: :short)
import { createContext, useCallback, useContext, useEffect, useMemo, useState } from 'react';
export const RouterContext = createContext(null);
export function RouterProvider({ children }) {
const [path, setPath] = useState(() => window.location.pathname);
import { useEffect, useState } from "react";
export function useDebounce(value, delay = 300) {
const [debounced, setDebounced] = useState(value);
useEffect(() => {
export interface Todo {
id: string;
title: string;
completed: boolean;
}
class LikesController < ApplicationController
before_action :set_post
def create
@like = @post.likes.find_or_create_by(user: current_user)