Skip to content

Commit

Permalink
Merge pull request #90 from kamranahmedse/master
Browse files Browse the repository at this point in the history
Create a new pull request by comparing changes across two branches
  • Loading branch information
GulajavaMinistudio authored Jul 21, 2023
2 parents 9a9b940 + 34d0cde commit efd4648
Show file tree
Hide file tree
Showing 102 changed files with 5,629 additions and 184 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
"preact": "^10.15.1",
"rehype-external-links": "^2.1.0",
"roadmap-renderer": "^1.0.6",
"slugify": "^1.6.6",
"tailwindcss": "^3.3.2"
},
"devDependencies": {
Expand Down
8 changes: 8 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file modified public/authors/kamran.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified public/og-images/sql-roadmap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
95 changes: 56 additions & 39 deletions src/components/AccountSidebar.astro
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
---
import AstroIcon from './AstroIcon.astro';
const { activePageId, activePageTitle } = Astro.props;
import { TeamDropdown } from './TeamDropdown/TeamDropdown';
export interface Props {
activePageId: string;
activePageTitle: string;
hasDesktopSidebar?: boolean;
}
const { hasDesktopSidebar = true, activePageId, activePageTitle } = Astro.props;
const sidebarLinks = [
{
href: '/account',
Expand Down Expand Up @@ -64,6 +66,17 @@ const sidebarLinks = [
id='settings-menu-dropdown'
class='absolute left-0 right-0 z-10 mt-1 hidden space-y-1.5 bg-white p-2 shadow-lg'
>
<!--<li>-->
<!-- <a-->
<!-- href='/team'-->
<!-- class={`flex w-full items-center rounded px-3 py-1.5 text-sm text-slate-900 hover:bg-slate-200 ${-->
<!-- activePageId === 'team' ? 'bg-slate-100' : ''-->
<!-- }`}-->
<!-- >-->
<!-- <AstroIcon icon={'users'} class={`h-4 w-4 mr-2`} />-->
<!-- Teams-->
<!-- </a>-->
<!--</li>-->
{
sidebarLinks.map((sidebarLink) => {
const isActive = activePageId === sidebarLink.id;
Expand Down Expand Up @@ -91,48 +104,52 @@ const sidebarLinks = [

<div class='container flex min-h-screen items-stretch'>
<!-- Start Desktop Sidebar -->
<aside class='hidden w-44 shrink-0 border-r border-slate-200 py-10 md:block'>
<nav>
<ul class='space-y-1'>
{
sidebarLinks.map((sidebarLink) => {
const isActive = activePageId === sidebarLink.id;
{
hasDesktopSidebar && (
<aside class='hidden w-[195px] shrink-0 border-r border-slate-200 py-10 md:block'>
<TeamDropdown client:load />

return (
<li>
<a
href={sidebarLink.href}
class={`font-regular flex w-full items-center border-r-2 px-2 py-1.5 text-sm ${
isActive
? 'border-r-black bg-gray-100 text-black'
: 'border-r-transparent text-gray-500 hover:border-r-gray-300'
}`}
>
<span class='flex flex-grow items-center'>
<AstroIcon
icon={sidebarLink.icon.glyph}
class={`${sidebarLink.icon.classes} mr-2`}
/>
{sidebarLink.title}
</span>
<nav>
<ul class='space-y-1'>
{sidebarLinks.map((sidebarLink) => {
const isActive = activePageId === sidebarLink.id;

{sidebarLink.isNew && !isActive && (
<span class='relative mr-1 flex items-center'>
<span class='relative rounded-full bg-gray-200 p-1 text-xs' />
<span class='absolute bottom-0 left-0 right-0 top-0 animate-ping rounded-full bg-gray-400 p-1 text-xs' />
return (
<li>
<a
href={sidebarLink.href}
class={`font-regular flex w-full items-center border-r-2 px-2 py-1.5 text-sm ${
isActive
? 'border-r-black bg-gray-100 text-black'
: 'border-r-transparent text-gray-500 hover:border-r-gray-300'
}`}
>
<span class='flex flex-grow items-center'>
<AstroIcon
icon={sidebarLink.icon.glyph}
class={`${sidebarLink.icon.classes} mr-2`}
/>
{sidebarLink.title}
</span>
)}
</a>
</li>
);
})
}
</ul>
</nav>
</aside>

{sidebarLink.isNew && !isActive && (
<span class='relative mr-1 flex items-center'>
<span class='relative rounded-full bg-gray-200 p-1 text-xs' />
<span class='absolute bottom-0 left-0 right-0 top-0 animate-ping rounded-full bg-gray-400 p-1 text-xs' />
</span>
)}
</a>
</li>
);
})}
</ul>
</nav>
</aside>
)
}
<!-- /End Desktop Sidebar -->

<div class='grow px-0 py-0 md:px-10 md:py-10'>
<div class:list={['grow px-0 py-0 md:py-10', { 'md:px-10': hasDesktopSidebar, 'md:px-5': !hasDesktopSidebar }]}>
<slot />
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/components/Activity/ActivityPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { ResourceProgress } from './ResourceProgress';
import { pageProgressMessage } from '../../stores/page';
import { EmptyActivity } from './EmptyActivity';

type ActivityResponse = {
export type ActivityResponse = {
done: {
today: number;
total: number;
Expand Down
76 changes: 43 additions & 33 deletions src/components/Activity/ResourceProgress.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { useState } from 'preact/hooks';
import { httpPost } from '../../lib/http';
import { getRelativeTimeString } from '../../lib/date';
import { useToast } from '../../hooks/use-toast';

type ResourceProgressType = {
resourceType: 'roadmap' | 'best-practice';
Expand All @@ -11,10 +12,13 @@ type ResourceProgressType = {
doneCount: number;
learningCount: number;
skippedCount: number;
onCleared: () => void;
onCleared?: () => void;
showClearButton?: boolean;
};

export function ResourceProgress(props: ResourceProgressType) {
const { showClearButton = true } = props;
const toast = useToast();
const [isClearing, setIsClearing] = useState(false);
const [isConfirming, setIsConfirming] = useState(false);

Expand All @@ -41,7 +45,7 @@ export function ResourceProgress(props: ResourceProgressType) {
);

if (error || !response) {
alert('Error clearing progress. Please try again.');
toast.error('Error clearing progress. Please try again.');
console.error(error);
setIsClearing(false);
return;
Expand All @@ -52,7 +56,9 @@ export function ResourceProgress(props: ResourceProgressType) {

setIsClearing(false);
setIsConfirming(false);
onCleared();
if (onCleared) {
onCleared();
}
}

const url =
Expand Down Expand Up @@ -101,38 +107,42 @@ export function ResourceProgress(props: ResourceProgressType) {
)}
<span>{totalCount} total</span>
</span>
{!isConfirming && (
<button
className="text-red-500 hover:text-red-800"
onClick={() => setIsConfirming(true)}
disabled={isClearing}
>
{!isClearing && (
<>
Clear Progress <span>&times;</span>
</>
)}
{showClearButton && (
<>
{!isConfirming && (
<button
className="text-red-500 hover:text-red-800"
onClick={() => setIsConfirming(true)}
disabled={isClearing}
>
{!isClearing && (
<>
Clear Progress <span>&times;</span>
</>
)}

{isClearing && 'Processing...'}
</button>
)}
{isClearing && 'Processing...'}
</button>
)}

{isConfirming && (
<span>
Are you sure?{' '}
<button
onClick={clearProgress}
className="ml-1 mr-1 text-red-500 underline hover:text-red-800"
>
Yes
</button>{' '}
<button
onClick={() => setIsConfirming(false)}
className="text-red-500 underline hover:text-red-800"
>
No
</button>
</span>
{isConfirming && (
<span>
Are you sure?{' '}
<button
onClick={clearProgress}
className="ml-1 mr-1 text-red-500 underline hover:text-red-800"
>
Yes
</button>{' '}
<button
onClick={() => setIsConfirming(false)}
className="text-red-500 underline hover:text-red-800"
>
No
</button>
</span>
)}
</>
)}
</p>
</div>
Expand Down
Loading

0 comments on commit efd4648

Please sign in to comment.