mirror of
https://github.com/dsoaress/link-free.git
synced 2026-08-19 07:56:03 +01:00
fix: fix initial in dash
This commit is contained in:
@@ -3,6 +3,7 @@ import { useEffect, useState } from 'react'
|
|||||||
import Collapsible from 'react-collapsible'
|
import Collapsible from 'react-collapsible'
|
||||||
|
|
||||||
import { useData } from '../../hooks/useData'
|
import { useData } from '../../hooks/useData'
|
||||||
|
import type { Data } from '../../types/Data'
|
||||||
import { getLocalStorageData, setLocalStorageData } from '../../utils/localStorage'
|
import { getLocalStorageData, setLocalStorageData } from '../../utils/localStorage'
|
||||||
import { Home } from '../Home'
|
import { Home } from '../Home'
|
||||||
import { ColorsSettings } from './ColorsSettings'
|
import { ColorsSettings } from './ColorsSettings'
|
||||||
@@ -10,12 +11,15 @@ import { DataSettings } from './DataSettings'
|
|||||||
import { SaveChangesAlert } from './SaveChangesAlert'
|
import { SaveChangesAlert } from './SaveChangesAlert'
|
||||||
import { Content, Preview, Wrapper } from './styles'
|
import { Content, Preview, Wrapper } from './styles'
|
||||||
|
|
||||||
export function Dash() {
|
type DashProps = {
|
||||||
|
initialData: Data
|
||||||
|
}
|
||||||
|
|
||||||
|
export function Dash({ initialData }: DashProps) {
|
||||||
const { data, setData } = useData()
|
const { data, setData } = useData()
|
||||||
const [isLoading, setIsLoading] = useState(true)
|
const [isLoading, setIsLoading] = useState(true)
|
||||||
const [hasUnsavedChanges, setHasUnsavedChanges] = useState(false)
|
const [hasUnsavedChanges, setHasUnsavedChanges] = useState(false)
|
||||||
const [activeTab, setActiveTab] = useState<'data' | 'colors'>('data')
|
const [activeTab, setActiveTab] = useState<'data' | 'colors'>('data')
|
||||||
const initialData = data
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (isLoading) {
|
if (isLoading) {
|
||||||
|
|||||||
@@ -2,9 +2,14 @@ import { GetServerSideProps } from 'next'
|
|||||||
|
|
||||||
import { Dash } from '../components/Dash'
|
import { Dash } from '../components/Dash'
|
||||||
import { fetchData } from '../services/fetchData'
|
import { fetchData } from '../services/fetchData'
|
||||||
|
import type { Data } from '../types/Data'
|
||||||
|
|
||||||
export default function DashPage() {
|
type DashPageProps = {
|
||||||
return <Dash />
|
initialData: Data
|
||||||
|
}
|
||||||
|
|
||||||
|
export default function DashPage({ initialData }: DashPageProps) {
|
||||||
|
return <Dash initialData={initialData} />
|
||||||
}
|
}
|
||||||
|
|
||||||
export const getServerSideProps: GetServerSideProps = async () => {
|
export const getServerSideProps: GetServerSideProps = async () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user