forked from OvidijusParsiunas/deep-chat
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e4b915c
commit b1c9bf5
Showing
23 changed files
with
86 additions
and
5 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
.preload-image { | ||
width: 1px; | ||
position: absolute; | ||
opacity: 0.1; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
import huggingFaceLogo from '/img/huggingFaceLogo.png'; | ||
import lofiBackground from '/img/lofi-background.webp'; | ||
import blueBackground from '/img/blue-background.jpg'; | ||
import assemblyAILogo from '/img/assemblyAILogo.png'; | ||
import openAILogo from '/img/openAILogo.png'; | ||
import cohereLogo from '/img/cohereLogo.png'; | ||
import azureLogo from '/img/azureLogo.png'; | ||
import bird from '/img/bird.jpeg'; | ||
import city from '/img/city.jpeg'; | ||
import './preloadImages.css'; | ||
import React from 'react'; | ||
|
||
// this is an optimization approach to stop images rendering whilst they are being displayed | ||
export default function PreloadImages() { | ||
const [displayContentImages, setDisplayContentImages] = React.useState(false); | ||
const [displayBackgroundImages, setDisplayBackgroundImages] = React.useState(false); | ||
|
||
// executed sequentially from what is displayed first | ||
React.useEffect(() => { | ||
let isMounted = true; | ||
setTimeout(() => { | ||
if (isMounted) { | ||
setDisplayContentImages(true); | ||
setTimeout(() => { | ||
if (isMounted) setDisplayBackgroundImages(true); | ||
}, 2000); | ||
} | ||
}, 1000); | ||
return () => { | ||
isMounted = false; | ||
}; | ||
}, []); | ||
|
||
return ( | ||
<div> | ||
<div className="preload-image"> | ||
<img src={huggingFaceLogo} /> | ||
</div> | ||
<div className="preload-image"> | ||
<img src={openAILogo} /> | ||
</div> | ||
<div className="preload-image"> | ||
<img src={cohereLogo} /> | ||
</div> | ||
<div className="preload-image"> | ||
<img src={azureLogo} /> | ||
</div> | ||
<div className="preload-image"> | ||
<img src={assemblyAILogo} /> | ||
</div> | ||
{displayContentImages && ( | ||
<div> | ||
<div className="preload-image"> | ||
<img src={bird} /> | ||
</div> | ||
<div className="preload-image"> | ||
<img src={city} /> | ||
</div> | ||
</div> | ||
)} | ||
{displayBackgroundImages && ( | ||
<div> | ||
<div className="preload-image"> | ||
<img src={blueBackground} /> | ||
</div> | ||
<div className="preload-image"> | ||
<img src={lofiBackground} /> | ||
</div> | ||
</div> | ||
)} | ||
</div> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.