Skip to content

Commit

Permalink
Promote github page after export (#20)
Browse files Browse the repository at this point in the history
  • Loading branch information
KennethWussmann authored Nov 9, 2024
1 parent 5881c04 commit de54419
Show file tree
Hide file tree
Showing 6 changed files with 50 additions and 27 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ dev-dist
dist-ssr
*.local
*.tsbuildinfo
.env

# Editor directories and files
!.vscode/extensions.json
Expand Down
10 changes: 10 additions & 0 deletions src/components/common/star-on-github-button.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { Github } from "lucide-react"
import { Button } from "../ui"
import { config } from "@/lib/config";

export const StarOnGitHubButton = () => {
const openGitHub = () => {
window.open(config.githubURL, "_blank", "noopener,noreferrer");
};
return <Button size={"lg"} variant={"ghost"} onClick={openGitHub}><Github /> Star on GitHub</Button>
}
13 changes: 4 additions & 9 deletions src/components/export/task/caption-export-summary.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { useImages } from "@/hooks/use-images";
import { Check, FileText, Images } from "lucide-react";
import { FileText, Images } from "lucide-react";
import { Separator } from "../../ui";
import { useExportProgress } from "../export-progress-provider";
import { ExportSuccessfulSummaryMessage } from "./export-successful-summary-message";

export const CaptionExportSummary = () => {
const { allImages } = useImages();
Expand Down Expand Up @@ -37,13 +38,7 @@ export const CaptionExportSummary = () => {
You labeled {items.length} out of {allImages.length} images
</div>
</div>
{percentage === 100 && (<>
<Separator />
<div className="flex gap-4 items-center">
<Check className="h-8 w-8" />
Export successful
</div>
</>)}
</div>
{percentage === 100 && <ExportSuccessfulSummaryMessage />}
</div >
);
};
30 changes: 30 additions & 0 deletions src/components/export/task/export-successful-summary-message.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import { StarOnGitHubButton } from "@/components/common/star-on-github-button"
import { Separator } from "@/components/ui"
import { config } from "@/lib/config"
import { productName } from "@/lib/constants"
import { Check } from "lucide-react"

export const ExportSuccessfulSummaryMessage = () => {

return (
<>
<Separator />
<div className="flex gap-4 items-center">
<Check className="h-8 w-8" />
Export successful
</div>
{config.demoMode && (
<>
<Separator />
<div className="flex flex-row gap-2 items-center">
<div>
Do you like {productName}?
Please consider starring the project on GitHub!
</div>
<StarOnGitHubButton />
</div>
</>
)}
</>
)
}
12 changes: 3 additions & 9 deletions src/components/export/task/sort-export-summary.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { useImages } from "@/hooks/use-images";
import { Check, FolderInput } from "lucide-react";
import { Separator } from "../../ui";
import { FolderInput } from "lucide-react";
import { useExportProgress } from "../export-progress-provider";
import { ExportItem } from "../types";
import { unique } from "@/lib/utils";
Expand All @@ -13,6 +12,7 @@ import {
TableHeader,
TableRow,
} from "@/components/ui/table"
import { ExportSuccessfulSummaryMessage } from "./export-successful-summary-message";


const getDirectoriesCreated = (items: ExportItem[]): Record<string, number> => {
Expand Down Expand Up @@ -78,13 +78,7 @@ export const SortExportSummary = () => {
))}
</TableBody>
</Table>
{percentage === 100 && (<>
<Separator />
<div className="flex gap-4 items-center">
<Check className="h-8 w-8" />
Export successful
</div>
</>)}
{percentage === 100 && <ExportSuccessfulSummaryMessage />}
</div>
);
};
11 changes: 2 additions & 9 deletions src/pages/setup/footer.tsx
Original file line number Diff line number Diff line change
@@ -1,18 +1,11 @@
import { Button } from "@/components/ui"
import { StarOnGitHubButton } from "@/components/common/star-on-github-button"
import { config } from "@/lib/config"
import { Github } from "lucide-react"

export const Footer = () => {
const openGitHub = () => {
window.open(config.githubURL, "_blank", "noopener,noreferrer");
};

return (
<div className="absolute left-0 bottom-8 w-full">
<div className="flex flex-col gap-2 justify-center items-center align-middle">
{config.demoMode && (
<Button size={"lg"} variant={"ghost"} onClick={openGitHub}><Github /> Star on GitHub</Button>
)}
{config.demoMode && <StarOnGitHubButton />}
<div className="flex flex-row gap-4 justify-center text-muted-foreground text-xs">
{config.imprintUrl && (<a href={config.imprintUrl} target="_blank" className="hover:underline">Imprint</a>)}
{config.privacyUrl && (<a href={config.privacyUrl} target="_blank" className="hover:underline">Privacy Policy</a>)}
Expand Down

0 comments on commit de54419

Please sign in to comment.