Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix link order && various imporovements #101

Merged
merged 3 commits into from
Jan 9, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions apps/studio/next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@ const nextConfig = {
*/
// swcMinify: true,
optimizeFonts: true,
images: {
domains: [
"luvvzhalwfofocddxfrk.supabase.in",
"qatejhwdylvqgwcegrjn.supabase.in",
],
},
async Headers() {
return [
{
Expand Down
15 changes: 8 additions & 7 deletions apps/studio/src/components/common/Header/Menu.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import Image from "next/image";
import Link from "../Link";
import NewLinkDialog from "~/components/dashboard/AddLinkDialog";
import { Plus, Dropdown, Avatar, Feather, Trello } from "@biolnk/gamut";
import { Plus, Dropdown, Feather } from "@biolnk/gamut";
import { useAppContext } from "~/data/context";
import { useSupabase } from "~/lib/supabase";
import { Routes } from "~/data/enums/routes";
Expand All @@ -17,7 +18,6 @@ const Menu: FC<MenuProps> = ({ user, pageLink }) => {
const { addLinkDialog } = useAppContext();

const avatarAlt = `${user?.username} profile`;
const avatarFallback = user?.username ?? "Biolnk";

return (
<>
Expand All @@ -28,11 +28,12 @@ const Menu: FC<MenuProps> = ({ user, pageLink }) => {

<Dropdown
trigger={
<button type="button">
<Avatar
<button type="button" className="rounded-full flex">
<Image
src={user?.avatar_url}
alt={avatarAlt}
fallback={avatarFallback}
width={36}
height={36}
/>
</button>
}
Expand All @@ -50,7 +51,7 @@ const Menu: FC<MenuProps> = ({ user, pageLink }) => {

<Dropdown.Group>
{/* @ts-ignore */}
<Dropdown.ListItem as={Link} url={pageLink} isExternal noIcon>
<Dropdown.ListItem as={Link} url={pageLink} external noIcon>
My Page
</Dropdown.ListItem>
<Dropdown.ListItem
Expand All @@ -66,7 +67,7 @@ const Menu: FC<MenuProps> = ({ user, pageLink }) => {
// @ts-ignore
url="https://github.com/Kerosz/biolnk/issues/new?assignees=&labels=bug&template=bug-report-template.md&title="
rightIcon={Feather}
isExternal
external
noIcon
>
Submit an Issue
Expand Down
4 changes: 3 additions & 1 deletion apps/studio/src/components/dashboard/LinkCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ const LinkCard: FC<Link> = ({
}
}, [previewToggle.isOpen]);

const linkMode = previewToggle.isOpen ? "visible" : "hidden";

return (
<>
<ConfirmDialog
Expand Down Expand Up @@ -116,7 +118,7 @@ const LinkCard: FC<Link> = ({
{title}
</Text>

<Tooltip content="Preview Mode">
<Tooltip content={`Preview Mode ( ${linkMode} )`}>
<Toggle
aria-label="Toggle visibility"
label="Toggle visibility"
Expand Down
26 changes: 14 additions & 12 deletions apps/web/src/components/page/PageContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -75,18 +75,20 @@ const PageContent: FC<PageContentProps> = ({

{links.length > 0 ? (
<div className="mt-6 mb-28">
{links.map((l) => (
<Link
key={l.id}
url={l.url}
className="mb-4 last:mb-0 h-14 w-full flex justify-center transform-gpu animate-decelerate hover:scale-[1.03]"
style={CSSstring(style.button.css)}
external
noIcon
>
<Text style={getTextStyles("button")}>{l.title}</Text>
</Link>
))}
{links
.filter((l) => l.visible !== false)
.map((l) => (
<Link
key={l.id}
url={l.url}
className="mb-4 last:mb-0 h-14 w-full flex justify-center transform-gpu animate-decelerate hover:scale-[1.03]"
style={CSSstring(style.button.css)}
external
noIcon
>
<Text style={getTextStyles("button")}>{l.title}</Text>
</Link>
))}
</div>
) : null}
</div>
Expand Down
3 changes: 2 additions & 1 deletion apps/web/src/components/page/getStaticProps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ export const getStaticProps: GetStaticProps<{}, PageParams> = async ({
const linkRecords = await sbClient
.from<Link>(Tables.LINKS)
.select("*")
.eq("user_id", pageRecord.data.user.id);
.eq("user_id", pageRecord.data.user.id)
.order("display_order", { ascending: true });

if (!linkRecords.data || linkRecords.error) {
return {
Expand Down