This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const PER_PAGE = 30; | |
const [current_page,setPage] = useState(0); | |
const ITEM_HEIGHT = 55; //each item height including vertical padding/margin | |
const calculatePage = (e: NativeSyntheticEvent<NativeScrollEvent>) => { | |
const cPage = Math.floor(e.nativeEvent.contentOffset.y / (ITEM_HEIGHT * (current_page + 1 * PER_PAGE))); | |
console.log(cPage); | |
return cPage; | |
}; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Show hidden characters
[ | |
// add namespace | |
{ "keys": ["f6"], "command": "import_namespace" }, | |
// add constructor property | |
{ "keys": ["f7"], "command": "insert_php_constructor_property" }, | |
// add namespace to class (expand to fully qualified class name) | |
{ "keys": ["f9"], "command": "expand_fqcn" }, | |
// add FQCN to use statements | |
{ "keys": ["f10"], "command": "find_use" }, | |
// ace jump to a word |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//copied from twillio-demo-app | |
import { type Middleware } from '@reduxjs/toolkit'; | |
import { type Dispatch, type State } from '../app'; | |
export type LogOptions = Readonly<{ | |
logStackTrace?: boolean; | |
}>; | |
export const logMiddlewareDefaultOptions: LogOptions = Object.freeze({ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
VITE_SHOPIFY_API_KEY=xxxxxx | |
SHOPIFY_API_KEY=xxxxxxx | |
SHOPIFY_API_SECRET=xxxxxx | |
SHOPIFY_FRONTEND_ENGINE=REACT | |
SHOPIFY_BILLING_ENABLED=true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace Osiset\ShopifyApp\Http\Middleware; | |
use Closure; | |
use Illuminate\Http\Request; | |
use Illuminate\Support\Facades\Redirect; | |
use Osiset\ShopifyApp\Contracts\Queries\Shop as ShopQuery; | |
use Osiset\ShopifyApp\Contracts\ShopModel as IShopModel; | |
use Osiset\ShopifyApp\Objects\Values\ShopDomain; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use Illuminate\Support\Facades\Route; | |
/* | |
|-------------------------------------------------------------------------- | |
| Web Routes | |
|-------------------------------------------------------------------------- | |
| | |
| Here is where you can register web routes for your application. These |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}"> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | |
<title>Shopify Laravel Example</title> | |
@viteReactRefresh | |
@vite('resources/js/app.js') | |
</head> | |
<body> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import './bootstrap'; | |
import "../css/app.css"; | |
import '../frontend/index.jsx' //import react frontend entry file |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { defineConfig, loadEnv } from "vite"; | |
import laravel from "laravel-vite-plugin"; | |
import react from "@vitejs/plugin-react"; | |
import fs from "node:fs"; | |
export default defineConfig(function ({ mode }) { | |
process.env = { ...process.env, ...loadEnv(mode, process.cwd()) }; //process.env is not accessible directly in this file so we have to do this | |
return { | |
plugins: [ | |
laravel(["resources/css/app.css", "resources/js/app.js"]), | |
react(), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"private": true, | |
"scripts": { | |
"dev": "vite", | |
"build": "vite build" | |
}, | |
"dependencies": { | |
"@shopify/app-bridge": "^3.1.0", | |
"@shopify/app-bridge-react": "^3.1.0", | |
"@shopify/app-bridge-utils": "^3.1.0", |