Skip to content

Commit

Permalink
Merge branch 'Weaverse:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
hta218 authored Jul 3, 2024
2 parents a2baac5 + 2c8f444 commit 629f183
Show file tree
Hide file tree
Showing 86 changed files with 1,730 additions and 1,266 deletions.
2 changes: 1 addition & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@ WEAVERSE_PROJECT_ID="your-project-id"

# Additional services
#PUBLIC_GOOGLE_GTM_ID=G-R1KFYYKE48
#JUDGEME_PUBLIC_TOKEN="your-judgeme-public-token"
#JUDGEME_PRIVATE_API_TOKEN="your-judgeme-private-api-token"

1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,6 @@ Export a `schema` object from the file to define the component's schema with def
export let schema: HydrogenComponentSchema = {
type: 'video',
title: 'Video',
toolbar: ['general-settings', ['duplicate', 'delete']],
inspector: [
{
group: 'Video',
Expand Down
29 changes: 16 additions & 13 deletions app/components/Button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,25 +38,29 @@ let variants = cva(
},
);

export interface ButtonStyleProps {
buttonStyle: "inherit" | "custom";
backgroundColor: string;
textColor: string;
borderColor: string;
backgroundColorHover: string;
textColorHover: string;
borderColorHover: string;
}

export interface ButtonProps
extends VariantProps<typeof variants>,
Omit<
HTMLAttributes<HTMLAnchorElement | HTMLButtonElement>,
"children" | "type"
>,
Partial<HydrogenComponentProps> {
Partial<HydrogenComponentProps>,
Partial<ButtonStyleProps> {
as?: keyof HTMLElementTagNameMap;
className?: string;
text: string;
link?: string;
openInNewTab?: boolean;
buttonStyle?: "inherit" | "custom";
backgroundColor?: string;
textColor?: string;
borderColor?: string;
backgroundColorHover?: string;
textColorHover?: string;
borderColorHover?: string;
}

let Button = forwardRef<HTMLElement, ButtonProps>((props, ref) => {
Expand Down Expand Up @@ -158,10 +162,6 @@ export let buttonContentInputs: InspectorGroup["inputs"] = [
},
];
export let buttonStylesInputs: InspectorGroup["inputs"] = [
{
type: "heading",
label: "Button styles",
},
{
type: "select",
name: "buttonStyle",
Expand Down Expand Up @@ -222,6 +222,10 @@ export let buttonStylesInputs: InspectorGroup["inputs"] = [

export let buttonInputs: InspectorGroup["inputs"] = [
...buttonContentInputs,
{
type: "heading",
label: "Button styles",
},
...buttonStylesInputs,
];

Expand All @@ -234,5 +238,4 @@ export let schema: HydrogenComponentSchema = {
inputs: buttonInputs,
},
],
toolbar: ["general-settings", ["duplicate", "delete"]],
};
1 change: 0 additions & 1 deletion app/components/Heading.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -220,5 +220,4 @@ export let schema: HydrogenComponentSchema = {
inputs: headingInputs,
},
],
toolbar: ["general-settings", ["duplicate", "delete"]],
};
1 change: 0 additions & 1 deletion app/components/Paragraph.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -128,5 +128,4 @@ export let schema: HydrogenComponentSchema = {
],
},
],
toolbar: ["general-settings", ["duplicate", "delete"]],
};
1 change: 0 additions & 1 deletion app/components/SubHeading.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -144,5 +144,4 @@ export let schema: HydrogenComponentSchema = {
],
},
],
toolbar: ["general-settings", ["duplicate", "delete"]],
};
37 changes: 0 additions & 37 deletions app/data/queries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,29 +42,6 @@ export let HOMEPAGE_FEATURED_PRODUCTS_QUERY = `#graphql
${PRODUCT_CARD_FRAGMENT}
`;

// @see: https://shopify.dev/api/storefront/current/queries/collections
export let FEATURED_COLLECTIONS_QUERY = `#graphql
query homepageFeaturedCollections($country: CountryCode, $language: LanguageCode)
@inContext(country: $country, language: $language) {
collections(
first: 4,
sortKey: UPDATED_AT
) {
nodes {
id
title
handle
image {
altText
width
height
url
}
}
}
}
` as const;

export let PRODUCT_INFO_QUERY = `#graphql
query ProductInfo(
$country: CountryCode
Expand Down Expand Up @@ -462,20 +439,6 @@ export let VARIANTS_QUERY = `#graphql
}
${PRODUCT_VARIANT_FRAGMENT}
` as const;
export let CUSTOMER_CREATE =
`#graphql mutation customerCreate($input: CustomerCreateInput!) {
customerCreate(input: $input) {
customer {
id
email
}
customerUserErrors {
field
message
code
}
}
}` as const;

export const METAOBJECTS_QUERY = `#graphql
query MetaObjects ($type: String!, $first: Int)
Expand Down
2 changes: 1 addition & 1 deletion app/lib/judgeme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export let getJudgemeReviews = async (
) => {
if (!api_token) {
return {
error: "Missing JUDGEME_PUBLIC_TOKEN",
error: "Missing JUDGEME_PRIVATE_API_TOKEN",
};
}
let internalId = await getInternalIdByHandle(api_token, shop_domain, handle);
Expand Down
6 changes: 6 additions & 0 deletions app/lib/menu.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
export function getMaxDepth(item: { items: any[] }): number {
if (item.items?.length > 0) {
return Math.max(...item.items.map(getMaxDepth)) + 1;
}
return 1;
}
16 changes: 16 additions & 0 deletions app/lib/type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,19 @@ export type I18nLocale = Locale & {
export type Storefront = HydrogenStorefront<I18nLocale>;

export type Alignment = "left" | "center" | "right";

export interface SingleMenuItem {
id: string;
title: string;
items: SingleMenuItem[];
to: string;
resource?: {
image?: {
altText: string;
height: number;
id: string;
url: string;
width: number;
};
}
}
7 changes: 5 additions & 2 deletions app/lib/utils.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { useLocation } from "@remix-run/react";
import type { FulfillmentStatus } from "@shopify/hydrogen/customer-account-api-types";
import type { MoneyV2 } from "@shopify/hydrogen/storefront-api-types";
import type { WeaverseImage } from "@weaverse/hydrogen";
import type { LinkHTMLAttributes } from "react";
import type {
ChildMenuItemFragment,
Expand Down Expand Up @@ -335,7 +334,11 @@ export function removeFalsy<T = any>(
}

export function getImageAspectRatio(
image: Partial<WeaverseImage>,
image: {
width?: number | null;
height?: number | null;
[key: string]: any;
},
aspectRatio: string,
) {
let aspRt: string | undefined;
Expand Down
9 changes: 8 additions & 1 deletion app/modules/Drawer.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Dialog, Transition } from "@headlessui/react";
import { useLocation } from "@remix-run/react";
import clsx from "clsx";
import { Fragment, useState } from "react";
import { Fragment, useEffect, useState } from "react";
import { IconCaretLeft } from "~/components/Icons";
import { cn } from "~/lib/cn";
import { Heading, IconClose } from "~/modules";
Expand Down Expand Up @@ -141,6 +142,12 @@ Drawer.Title = Dialog.Title;

export function useDrawer(openDefault = false) {
const [isOpen, setIsOpen] = useState(openDefault);
let { pathname } = useLocation();
useEffect(() => {
if (isOpen) {
closeDrawer();
}
}, [pathname]);

function openDrawer() {
setIsOpen(true);
Expand Down
49 changes: 0 additions & 49 deletions app/modules/FeaturedCollections.tsx

This file was deleted.

Loading

0 comments on commit 629f183

Please sign in to comment.