Skip to content

Commit

Permalink
Merge pull request #15 from sahrohit/develop
Browse files Browse the repository at this point in the history
build(blog): ✨ added blog site
  • Loading branch information
sahrohit authored Nov 27, 2023
2 parents 73a0cdc + 7ccec33 commit 4122c86
Show file tree
Hide file tree
Showing 77 changed files with 7,388 additions and 898 deletions.
4 changes: 2 additions & 2 deletions .lintstagedrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"apps/**/*.{ts,tsx,js,jsx}": ["eslint --fix"],
"packages/**/*.{ts,tsx,js,jsx}": ["eslint --fix"],
"apps/**/*.{ts,tsx,js,jsx,astro}": ["eslint --fix"],
"packages/**/*.{ts,tsx,js,jsx,astro}": ["eslint --fix"],
"**/*.{md,mdx,yml,json,babelrc,eslintrc,prettierrc}": ["prettier --write"]
}
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
auto-install-peers=true

9 changes: 4 additions & 5 deletions apps/admin/src/config/sidebar.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { FaUser } from "react-icons/fa";
import { BiPackage, BiSupport, BiCategoryAlt } from "react-icons/bi";
import { TbTruckReturn } from "react-icons/tb";
import { AiOutlineSetting } from "react-icons/ai";
import { AiOutlineSetting, AiOutlineShop } from "react-icons/ai";
import { BsArrowReturnLeft } from "react-icons/bs";

export const ORDER_NAV_LINKS = [
Expand All @@ -11,9 +10,9 @@ export const ORDER_NAV_LINKS = [
icon: BiPackage,
},
{
label: "Returns",
href: "/dashboard/returns",
icon: TbTruckReturn,
label: "Products",
href: "/dashboard/products",
icon: AiOutlineShop,
},
{
label: "Category",
Expand Down
3 changes: 2 additions & 1 deletion apps/admin/src/pages/dashboard/category.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ import {
} from "generated-graphql";
import FileUploadInputField from "@/components/ui/FileUploadInputField";
import { DataTable } from "@/components/ui/table";
import withProtected from "@/routes/withProtected";

interface TableActionsProps {
searchText: string;
Expand Down Expand Up @@ -405,4 +406,4 @@ const CategoryPage = () => {
);
};

export default CategoryPage;
export default withProtected(CategoryPage);
5 changes: 5 additions & 0 deletions apps/admin/src/pages/dashboard/orders.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import withProtected from "@/routes/withProtected";

const OrdersPage = () => <div>OrdersPage</div>;

export default withProtected(OrdersPage);
5 changes: 5 additions & 0 deletions apps/admin/src/pages/dashboard/products.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import withProtected from "@/routes/withProtected";

const ProductsPage = () => <div>ProductsPage</div>;

export default withProtected(ProductsPage);
3 changes: 2 additions & 1 deletion apps/admin/src/pages/dashboard/settings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import DeliveryOptions from "@/components/pages/settings/DeliveryOptions";
import Domains from "@/components/pages/settings/Domains";
import StoreContacts from "@/components/pages/settings/Contact";
import TenantKYC from "@/components/pages/settings/KYC";
import withProtected from "@/routes/withProtected";

const SETTING_TABS = [
{
Expand Down Expand Up @@ -100,4 +101,4 @@ const StoreSettings = () => (
</>
);

export default StoreSettings;
export default withProtected(StoreSettings);
4 changes: 3 additions & 1 deletion apps/admin/src/pages/dashboard/tickets.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import withProtected from "@/routes/withProtected";

const TicketsPage = () => <div>TicketsPage</div>;

export default TicketsPage;
export default withProtected(TicketsPage);
47 changes: 45 additions & 2 deletions apps/admin/src/pages/index.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,46 @@
const Home = () => <>Hello</>;
import UserProfile from "@/components/shared/sidebar/UserProfile";
import withProtected from "@/routes/withProtected";
import { Button, HStack, Heading, SimpleGrid, VStack } from "@chakra-ui/react";
import { useRouter } from "next/router";

export default Home;
const HomePage = () => {
const router = useRouter();

return (
<SimpleGrid height="100vh" width="100%" placeItems="center">
<Heading>Welcome Admin!</Heading>
<Button
colorScheme="primary"
onClick={() => {
router.push("/dashboard");
}}
>
Go to Dashboard
</Button>
<VStack>
<HStack gap={4}>
<Button
colorScheme="secondary"
onClick={() => {
router.push("/auth/login");
}}
>
Login
</Button>

<Button
colorScheme="secondary"
onClick={() => {
router.push("/auth/register");
}}
>
Register
</Button>
</HStack>
<UserProfile />
</VStack>
</SimpleGrid>
);
};

export default withProtected(HomePage);
11 changes: 11 additions & 0 deletions apps/api/src/resolvers/admin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ import { Tenant } from "../entities/Tenant";
import { TenantContact } from "../entities/TenantContant";
import { Staff } from "../entities/Staff";
import { addDomainToVercel } from "./domain";
import { ProductCategory } from "../entities/ProductCategory";
import { nanoid } from "nanoid";

@Resolver()
export class AdminResolver {
Expand Down Expand Up @@ -191,6 +193,15 @@ export class AdminResolver {

await addDomainToVercel(`${options.subdomain}${COMPANY.domain}`);

await ProductCategory.save({
name: "General",
identifier: `general-${nanoid(6)}`,
desc: "General Category for all you products",
tenantId: tenant.id,
imageURL:
"https://images.unsplash.com/photo-1543855549-4ab79f1860b8?auto=format&fit=crop&q=80&w=1974&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D",
});

return {
user: await User.findOneOrFail({
relations: {
Expand Down
6 changes: 6 additions & 0 deletions apps/blog/.eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.husky
.vscode
node_modules
public
dist
.yarn
9 changes: 9 additions & 0 deletions apps/blog/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module.exports = {
root: true,
extends: ["custom/astro"],
parserOptions: {
tsconfigRootDir: __dirname,
project: "./tsconfig.json",
extraFileExtensions: [".astro"],
},
};
35 changes: 35 additions & 0 deletions apps/blog/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# build output
dist/
.output/

# dependencies
node_modules/

# logs
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*


# environment variables
.env
.env.production

# macOS-specific files
.DS_Store

# ignore .astro directory
.astro

# ignore Jampack cache files
.jampack/

# yarn
.yarn/*
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/sdks
!.yarn/versions
.pnp.*
4 changes: 4 additions & 0 deletions apps/blog/.markdownlint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"MD033": false,
"MD013": false
}
3 changes: 3 additions & 0 deletions apps/blog/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
> The idea of developing a ecommerce application has crossed every developer mind once in their lifetime but we went a little further. This project started as on of those sites and grew to become this.
This is just a sample blog. But stay tuned, we'll be posting about our challenges we face as well as what's changed and everything that we publish here in these blog posts.
49 changes: 49 additions & 0 deletions apps/blog/astro.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
import { defineConfig } from "astro/config";
import tailwind from "@astrojs/tailwind";
import react from "@astrojs/react";
import remarkToc from "remark-toc";
import remarkCollapse from "remark-collapse";
import sitemap from "@astrojs/sitemap";
import { SITE } from "./src/config";

// https://astro.build/config
export default defineConfig({
site: SITE.website,
integrations: [
tailwind({
applyBaseStyles: false,
}),
react(),
sitemap(),
],
markdown: {
remarkPlugins: [
remarkToc,
[
remarkCollapse,
{
test: "Table of contents",
},
],
],
shikiConfig: {
theme: "one-dark-pro",
wrap: true,
},
},
vite: {
optimizeDeps: {
exclude: ["@resvg/resvg-js"],
},
ssr: {
noExternal: [
"astro",
"@astrojs/react",
"@astrojs/check",
"@astrojs/rss",
"@astrojs/tailwind",
],
},
},
scopedStyleStrategy: "where",
});
42 changes: 42 additions & 0 deletions apps/blog/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{
"name": "blog",
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "astro dev",
"start": "astro dev",
"build": "astro build && jampack ./dist",
"preview": "astro preview",
"sync": "astro sync",
"astro": "astro",
"format:check": "prettier --plugin-search-dir=. --check .",
"format": "prettier --plugin-search-dir=. --write .",
"lint:check": "eslint .",
"lint:fix": "eslint --fix ."
},
"dependencies": {
"@astrojs/check": "^0.3.0",
"@astrojs/rss": "^3.0.0",
"@resvg/resvg-js": "^2.6.0",
"astro": "^3.4.0",
"fuse.js": "^7.0.0",
"github-slugger": "^2.0.0",
"remark-collapse": "^0.1.2",
"remark-toc": "^9.0.0",
"satori": "^0.10.9",
"tailwindcss": "^3.3.5",
"typescript": "^5.2.2"
},
"devDependencies": {
"@astrojs/react": "^3.0.4",
"@astrojs/sitemap": "^3.0.2",
"@astrojs/tailwind": "^5.0.2",
"@divriots/jampack": "^0.21.1",
"@tailwindcss/typography": "^0.5.10",
"@types/react": "^18.2.33",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"eslint-config-custom": "workspace:*",
"tsconfig": "workspace:*"
}
}
Loading

2 comments on commit 4122c86

@vercel
Copy link

@vercel vercel bot commented on 4122c86 Nov 27, 2023

Choose a reason for hiding this comment

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

@vercel
Copy link

@vercel vercel bot commented on 4122c86 Nov 27, 2023

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.