feat(messages): add animations (#31)

This commit is contained in:
Walid
2022-08-31 20:44:33 +01:00
committed by GitHub
parent d51de554d6
commit cd164538de
98 changed files with 1133 additions and 551 deletions

View File

@ -1,9 +1,11 @@
import axios, { AxiosInstance } from 'axios'
import { io, Socket } from 'socket.io-client'
import type { AxiosInstance } from 'axios'
import axios from 'axios'
import type { Socket } from 'socket.io-client'
import { io } from 'socket.io-client'
import { API_URL } from '../api'
import { cookies } from '../cookies'
import { Tokens } from '.'
import type { Tokens } from '.'
import { fetchRefreshToken } from './authenticationFromServerSide'
import { clearCache } from '../cache'

View File

@ -3,8 +3,9 @@ import { useTheme } from 'next-themes'
import setLanguage from 'next-translate/setLanguage'
import useTranslation from 'next-translate/useTranslation'
import { Authentication, PagePropsWithAuthentication } from '.'
import { UserCurrent } from '../../models/User'
import type { PagePropsWithAuthentication } from '.'
import { Authentication } from '.'
import type { UserCurrent } from '../../models/User'
export interface AuthenticationValue {
authentication: Authentication

View File

@ -1,11 +1,11 @@
import { AxiosInstance, AxiosResponse } from 'axios'
import { GetServerSideProps, GetServerSidePropsContext } from 'next'
import type { AxiosInstance, AxiosResponse } from 'axios'
import type { GetServerSideProps, GetServerSidePropsContext } from 'next'
import { api } from '../api'
import { Cookies } from '../cookies'
import { RefreshTokenResponse, Tokens } from './index'
import type { RefreshTokenResponse, Tokens } from './index'
import { Authentication } from './Authentication'
import { UserCurrent } from '../../models/User'
import type { UserCurrent } from '../../models/User'
export const fetchRefreshToken = async (
refreshToken: string

View File

@ -1,4 +1,4 @@
import { UserCurrent } from '../../models/User'
import type { UserCurrent } from '../../models/User'
export interface RefreshTokenResponse {
accessToken: string

View File

@ -1,4 +1,4 @@
import { PaginationItem } from '../hooks/usePagination'
import type { PaginationItem } from '../hooks/usePagination'
export const GUILDS_CACHE_KEY = 'guilds' as const
export const CHANNELS_CACHE_KEY = 'channels' as const

View File

@ -1,5 +1,6 @@
import { SetItems } from '../hooks/usePagination'
import { CacheKey, savePaginationCache } from './cache'
import type { SetItems } from '../hooks/usePagination'
import type { CacheKey } from './cache'
import { savePaginationCache } from './cache'
export interface Item {
id: number
@ -33,14 +34,18 @@ export const handleSocketData = <T extends Item = Item>(
break
}
case 'delete': {
const itemIndex = newItems.findIndex((item) => item.id === data.item.id)
const itemIndex = newItems.findIndex((item) => {
return item.id === data.item.id
})
if (itemIndex !== -1) {
newItems.splice(itemIndex, 1)
}
break
}
case 'update': {
const itemIndex = newItems.findIndex((item) => item.id === data.item.id)
const itemIndex = newItems.findIndex((item) => {
return item.id === data.item.id
})
if (itemIndex !== -1) {
newItems[itemIndex] = {
...newItems[itemIndex],