Skip to content

Commit

Permalink
Merge pull request #801 from haqq-network/dev
Browse files Browse the repository at this point in the history
release
  • Loading branch information
kioqq authored May 1, 2024
2 parents 7032b59 + be78be6 commit 8c85a8e
Show file tree
Hide file tree
Showing 8 changed files with 1,362 additions and 1,994 deletions.
13 changes: 6 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,12 @@

## Applications and websites

| Description | Domain | Source code |
| -------------------- | ------------------------------ | ---------------------------- |
| Shell app | https://shell.haqq.network | [Open](apps/shell) |
| TestEdge2 Faucet app | https://testedge2.haqq.network | [Open](apps/faucet) |
| Vesting app | https://vesting.haqq.network | [Open](apps/vesting) |
| HAQQ Website | https://haqq.hetwork | [Open](apps/haqq-website) |
| IslamicCoin Website | https://islamiccoin.net | [Open](apps/islamic-website) |
| Description | Domain | Source code |
| ------------------- | ---------------------------- | ---------------------------- |
| Shell app | https://shell.haqq.network | [Open](apps/shell) |
| Vesting app | https://vesting.haqq.network | [Open](apps/vesting) |
| HAQQ Website | https://haqq.hetwork | [Open](apps/haqq-website) |
| IslamicCoin Website | https://islamiccoin.net | [Open](apps/islamic-website) |

## Development guide

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,12 @@ const analyticsCookieTable = [
col3: '1 day',
is_regex: false,
},
{
col1: '^ph_.*',
col2: 'posthog.com',
col3: '6 months',
is_regex: true,
},
];

const pluginConfig: UserConfig = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
'use client';
import clsx from 'clsx';
// import clsx from 'clsx';
import Image, { StaticImageData } from 'next/image';
import { useTranslations } from 'next-intl';
import { createSharedPathnamesNavigation } from 'next-intl/navigation';
// import { createSharedPathnamesNavigation } from 'next-intl/navigation';
import {
DownloadPDFButton,
MarkdownText,
Expand All @@ -15,37 +15,37 @@ import fatwaSign4 from '../../assets/images/autographs/autograph-mohamed-zoeir.w
import fatwaSign2 from '../../assets/images/autographs/autograph-saleh-yaqubi.webp';
import type { LocaleType } from '../shariah-page/shariah-page';

const { Link } = createSharedPathnamesNavigation({
locales: ['en', 'ar', 'id'],
});
// const { Link } = createSharedPathnamesNavigation({
// locales: ['en', 'ar', 'id'],
// });

function LangButton({
isActive,
locale,
href,
}: {
isActive: boolean;
locale: LocaleType;
href: string;
}) {
const t = useTranslations('shariah-page.fatwa-block.language-buttons');
return (
<Link
href={href}
locale={locale}
className={clsx(
'rtl:font-handjet font-vcr cursor-pointer rounded-[8px] px-[12px] py-[8px] text-[14px] font-[400] uppercase leading-[20px] text-white transition-colors duration-300',
isActive
? 'bg-islamic-primary-green'
: 'hover:bg-islamic-primary-green/50 bg-transparent',
)}
>
{locale === 'en' && t('english')}
{locale === 'ar' && t('arabic')}
{locale === 'id' && t('indonesian')}
</Link>
);
}
// function LangButton({
// isActive,
// locale,
// href,
// }: {
// isActive: boolean;
// locale: LocaleType;
// href: string;
// }) {
// const t = useTranslations('shariah-page.fatwa-block.language-buttons');
// return (
// <Link
// href={href}
// locale={locale}
// className={clsx(
// 'rtl:font-handjet font-vcr cursor-pointer rounded-[8px] px-[12px] py-[8px] text-[14px] font-[400] uppercase leading-[20px] text-white transition-colors duration-300',
// isActive
// ? 'bg-islamic-primary-green'
// : 'hover:bg-islamic-primary-green/50 bg-transparent',
// )}
// >
// {locale === 'en' && t('english')}
// {locale === 'ar' && t('arabic')}
// {locale === 'id' && t('indonesian')}
// </Link>
// );
// }

function Autograph({ name, image }: { name: string; image: StaticImageData }) {
return (
Expand Down Expand Up @@ -118,13 +118,17 @@ export function FatwaBlock({
<DownloadPDFButton language="ar" url="/assets/fatwa-ar.pdf" />
</div>

<div className="mt-[40px] flex w-fit items-center gap-x-[8px] rounded-[10px] bg-[#2F2F2F] p-[6px] md:mt-[48px] lg:mt-[60px] rtl:flex-row-reverse">
{/* TEMPORARY HIDE FATWA LANG BUTTONS */}
{/* <div className="mt-[40px] flex w-fit items-center gap-x-[8px] rounded-[10px] bg-[#2F2F2F] p-[6px] md:mt-[48px] lg:mt-[60px] rtl:flex-row-reverse">
<LangButton isActive={locale === 'en'} locale="en" href="/shariah" />
<LangButton isActive={locale === 'ar'} locale="ar" href="/shariah" />
<LangButton isActive={locale === 'id'} locale="id" href="/shariah" />
</div>
</div> */}

<MarkdownText className="anchor-fix-fatwa mt-[30px]">
<MarkdownText
className="anchor-fix-fatwa mt-[30px]"
renderHeadingsAsLinks={false}
>
{fatwa}
</MarkdownText>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
'use client';
import { PropsWithChildren, useCallback, useEffect, useState } from 'react';
import {
PropsWithChildren,
useCallback,
useEffect,
useMemo,
useState,
} from 'react';
import clsx from 'clsx';
import Image from 'next/image';
import { useRouter } from 'next/navigation';
Expand Down Expand Up @@ -69,19 +75,6 @@ function MembersContainer({
);
}

const sections = [
{ id: 'fatwa', title: 'headings.fatwa' },
{ id: 'foundations', title: 'headings.foundations' },
{ id: 'shariah-oracle', title: 'headings.sharia-oracle' },
{ id: 'shariah-board', title: 'headings.shariah-board' },
{ id: 'advisory-board', title: 'headings.advisory-board' },
{ id: 'executive-board', title: 'headings.executive-board' },
];

const activeSectionsDefaultState = sections.map(() => {
return false;
});

export function ShariahPage({
shariahMembers,
executiveMembers,
Expand All @@ -96,24 +89,40 @@ export function ShariahPage({
locale: string;
}) {
const t = useTranslations('shariah-page');
const sections = useMemo(() => {
return [
{ id: 'fatwa', title: t('headings.fatwa') },
{ id: 'foundations', title: t('headings.foundations') },
{ id: 'shariah-oracle', title: t('headings.sharia-oracle') },
{ id: 'shariah-board', title: t('headings.shariah-board') },
{ id: 'advisory-board', title: t('headings.advisory-board') },
{ id: 'executive-board', title: t('headings.executive-board') },
];
}, [t]);
const activeSectionsDefaultState = sections.map(() => {
return false;
});
const { replace } = useRouter();
const [activeSection, setActiveSection] = useState('fatwa');
const [boardMember, setBoardMember] = useState<undefined | Member>(undefined);
const [activeSections, setActiveSections] = useState(
activeSectionsDefaultState,
);

const handleSectionInView = useCallback((id: string, inView: boolean) => {
const sectionIndex = sections.findIndex(({ id: sectionId }) => {
return sectionId === id;
});
const handleSectionInView = useCallback(
(id: string, inView: boolean) => {
const sectionIndex = sections.findIndex(({ id: sectionId }) => {
return sectionId === id;
});

setActiveSections((prevActiveSessions) => {
const newActiveSessions = [...prevActiveSessions];
newActiveSessions[sectionIndex] = inView;
return newActiveSessions;
});
}, []);
setActiveSections((prevActiveSessions) => {
const newActiveSessions = [...prevActiveSessions];
newActiveSessions[sectionIndex] = inView;
return newActiveSessions;
});
},
[sections],
);

useEffect(() => {
const activeIndex = activeSections.findIndex((inView) => {
Expand All @@ -125,7 +134,7 @@ export function ShariahPage({
} else {
setActiveSection(sections[0].id);
}
}, [activeSections]);
}, [activeSections, sections]);

// useEffect(() => {
// replace(`#${activeSection}`);
Expand Down Expand Up @@ -365,8 +374,6 @@ function ShariahPageDesktopNav({
sections: Array<{ id: string; title: string }>;
activeSection: string;
}) {
const t = useTranslations('shariah-page');

return (
<nav className="flex flex-col gap-y-[16px] rounded-[20px] bg-[#181E25b3] p-[28px] backdrop-blur">
{sections.map(({ id, title }) => {
Expand All @@ -376,7 +383,7 @@ function ShariahPageDesktopNav({
key={`sharia-nav-${id}`}
isActive={activeSection === id}
>
{t(title)}
{title}
</ShariahPageDesktopNavLink>
);
})}
Expand Down
62 changes: 34 additions & 28 deletions libs/islamic-website/ui-kit/src/lib/markdown-text/markdown-text.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,46 +61,52 @@ export function MarkdownTextProseWrapper({
);
}

function MarkdownHeading({
level,
children,
node,
}: PropsWithChildren<{
level: number;
node: ReactMarkdownProps['node'];
}>) {
const tagName = `h${level}`;
const id = node?.properties?.['id'];
return createElement(
tagName,
{ ...node?.properties },
<Link href={`#${id}`} className="group relative !text-white">
{children}
<LinkIcon className="ml-[8px] inline transition-opacity duration-150 ease-out lg:opacity-0 lg:group-hover:opacity-100" />
</Link>,
);
}

export function MarkdownText({
children,
className,
renderHeadingsAsLinks = true,
}: {
className?: string;
children: string;
renderHeadingsAsLinks?: boolean;
}) {
const renderHeading = ({
level,
children,
node,
}: PropsWithChildren<{
level: number;
node: ReactMarkdownProps['node'];
}>) => {
const tagName = `h${level}`;
const id = node?.properties?.['id'];
return createElement(
tagName,
{ ...node?.properties },
<Link href={`#${id}`} className="group relative !text-white">
{children}
<LinkIcon className="ml-[8px] inline transition-opacity duration-150 ease-out lg:opacity-0 lg:group-hover:opacity-100" />
</Link>,
);
};

return (
<MarkdownTextProseWrapper className={className}>
<ReactMarkdown
remarkPlugins={[remarkGfm]}
rehypePlugins={[rehypeRaw, rehypeSlug]}
components={{
h1: renderHeading,
h2: renderHeading,
h3: renderHeading,
h4: renderHeading,
h5: renderHeading,
h6: renderHeading,
}}
components={
renderHeadingsAsLinks
? {
h1: MarkdownHeading,
h2: MarkdownHeading,
h3: MarkdownHeading,
h4: MarkdownHeading,
h5: MarkdownHeading,
h6: MarkdownHeading,
}
: {}
}
>
{children}
</ReactMarkdown>
Expand Down
3 changes: 0 additions & 3 deletions libs/shell/ui-kit/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,6 @@
},
{
"path": "./tsconfig.spec.json"
},
{
"path": "./tsconfig.storybook.json"
}
]
}
Loading

1 comment on commit 8c85a8e

@vercel
Copy link

@vercel vercel bot commented on 8c85a8e May 8, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.