minor styling changes

This commit is contained in:
Sara
2023-11-22 13:53:12 +01:00
parent f14e6f5a7f
commit 4226428f58
3 changed files with 21 additions and 5 deletions

View File

@@ -15,6 +15,8 @@ import TranscriptTitle from "../transcriptTitle";
import Player from "../player"; import Player from "../player";
import WaveformLoading from "../waveformLoading"; import WaveformLoading from "../waveformLoading";
import { useRouter } from "next/navigation"; import { useRouter } from "next/navigation";
import { faSpinner } from "@fortawesome/free-solid-svg-icons";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
type TranscriptDetails = { type TranscriptDetails = {
params: { params: {

View File

@@ -6,6 +6,8 @@ import SelectSearch from "react-select-search";
import "react-select-search/style.css"; import "react-select-search/style.css";
import "../../styles/button.css"; import "../../styles/button.css";
import "../../styles/form.scss"; import "../../styles/form.scss";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { faSpinner } from "@fortawesome/free-solid-svg-icons";
type ShareLinkProps = { type ShareLinkProps = {
transcriptId: string; transcriptId: string;
@@ -20,6 +22,7 @@ const ShareLink = (props: ShareLinkProps) => {
const requireLogin = featureEnabled("requireLogin"); const requireLogin = featureEnabled("requireLogin");
const [isOwner, setIsOwner] = useState(false); const [isOwner, setIsOwner] = useState(false);
const [shareMode, setShareMode] = useState(props.shareMode); const [shareMode, setShareMode] = useState(props.shareMode);
const [shareLoading, setShareLoading] = useState(false);
const userinfo = useFiefUserinfo(); const userinfo = useFiefUserinfo();
const api = getApi(); const api = getApi();
@@ -46,6 +49,7 @@ const ShareLink = (props: ShareLinkProps) => {
const updateShareMode = async (selectedShareMode: string) => { const updateShareMode = async (selectedShareMode: string) => {
if (!api) return; if (!api) return;
setShareLoading(true);
const updatedTranscript = await api.v1TranscriptUpdate({ const updatedTranscript = await api.v1TranscriptUpdate({
transcriptId: props.transcriptId, transcriptId: props.transcriptId,
updateTranscript: { updateTranscript: {
@@ -53,6 +57,7 @@ const ShareLink = (props: ShareLinkProps) => {
}, },
}); });
setShareMode(updatedTranscript.shareMode); setShareMode(updatedTranscript.shareMode);
setShareLoading(false);
}; };
const privacyEnabled = featureEnabled("privacy"); const privacyEnabled = featureEnabled("privacy");
@@ -62,7 +67,7 @@ const ShareLink = (props: ShareLinkProps) => {
style={{ background: "rgba(96, 165, 250, 0.2)" }} style={{ background: "rgba(96, 165, 250, 0.2)" }}
> >
{requireLogin && ( {requireLogin && (
<p className="text-sm mb-2"> <div className="text-sm mb-2">
{shareMode === "private" && ( {shareMode === "private" && (
<p>This transcript is private and can only be accessed by you.</p> <p>This transcript is private and can only be accessed by you.</p>
)} )}
@@ -76,7 +81,7 @@ const ShareLink = (props: ShareLinkProps) => {
)} )}
{isOwner && api && ( {isOwner && api && (
<p> <div className="relative">
<SelectSearch <SelectSearch
className="select-search--top select-search" className="select-search--top select-search"
options={[ options={[
@@ -86,10 +91,19 @@ const ShareLink = (props: ShareLinkProps) => {
]} ]}
value={shareMode} value={shareMode}
onChange={updateShareMode} onChange={updateShareMode}
closeOnSelect={true}
/> />
</p> {shareLoading && (
<div className="h-4 w-4 absolute top-1/3 right-3 z-10">
<FontAwesomeIcon
icon={faSpinner}
className="animate-spin-slow text-gray-600 flex-grow rounded-lg md:rounded-xl h-4 w-4"
/>
</div>
)} )}
</p> </div>
)}
</div>
)} )}
{!requireLogin && ( {!requireLogin && (
<> <>

View File

@@ -5,7 +5,7 @@ export default () => (
<div className="flex flex-grow items-center justify-center h-20"> <div className="flex flex-grow items-center justify-center h-20">
<FontAwesomeIcon <FontAwesomeIcon
icon={faSpinner} icon={faSpinner}
className="animate-spin-slow text-gray-600 flex-grow rounded-lg md:rounded-xl h-10" className="animate-spin-slow text-gray-600 flex-grow rounded-lg md:rounded-xl h-10 w-10"
/> />
</div> </div>
); );