Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

deps: migrate charts #170

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "lib/charts"]
path = lib/charts
url = git@github.com:tradingview/charting_library.git
2 changes: 1 addition & 1 deletion app/trade/[base]/components/charts/price-chart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from "react"

import Script from "next/script"

import { ChartingLibraryWidgetOptions } from "@renegade-fi/tradingview-charts"
import { ChartingLibraryWidgetOptions } from "@/lib/charts"

import TradingViewChart from "@/app/trade/[base]/components/charts/tradingview"

Expand Down
2 changes: 1 addition & 1 deletion app/trade/[base]/components/charts/tradingview/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
DatafeedConfiguration,
Favorites,
ResolutionString,
} from "@renegade-fi/tradingview-charts"
} from "@/lib/charts"

export const datafeedConfig = {
supported_resolutions: [
Expand Down
2 changes: 1 addition & 1 deletion app/trade/[base]/components/charts/tradingview/datafeed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import {
Bar,
IBasicDataFeed,
LibrarySymbolInfo,
} from "@renegade-fi/tradingview-charts"
} from "@/lib/charts"

import {
subscribeOnStream,
Expand Down
2 changes: 1 addition & 1 deletion app/trade/[base]/components/charts/tradingview/helpers.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Bar } from "@renegade-fi/tradingview-charts"
import { Bar } from "@/lib/charts"

// Amberdata API URL
const BASE_URL = "https://api.amberdata.com"
Expand Down
2 changes: 1 addition & 1 deletion app/trade/[base]/components/charts/tradingview/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
LanguageCode,
ResolutionString,
widget,
} from "@renegade-fi/tradingview-charts"
} from "@/lib/charts"

import { config } from "@/app/trade/[base]/components/charts/tradingview/config"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {
LibrarySymbolInfo,
ResolutionString,
SubscribeBarsCallback,
} from "@renegade-fi/tradingview-charts"
} from "@/lib/charts"

interface SubscriptionItem {
subscriberUID: string
Expand Down
2 changes: 1 addition & 1 deletion hooks/use-ohlc.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Bar } from "@renegade-fi/tradingview-charts"
import { Bar } from "@/lib/charts"
import { useQuery, UseQueryResult } from "@tanstack/react-query"

import { fetchBars } from "@/lib/amberdata"
Expand Down
2 changes: 1 addition & 1 deletion lib/amberdata.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Bar } from "@renegade-fi/tradingview-charts"
import { Bar } from "@/lib/charts"
import invariant from "tiny-invariant"

import { makeAmberApiRequest } from "@/app/trade/[base]/components/charts/tradingview/helpers"
Expand Down
1 change: 1 addition & 0 deletions lib/charts
Submodule charts added at 1cc3ce
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
"@radix-ui/react-visually-hidden": "^1.1.0",
"@renegade-fi/internal-sdk": "0.0.0-canary-20240829175257",
"@renegade-fi/react": "0.4.1",
"@renegade-fi/tradingview-charts": "0.27.6",
"@tanstack/react-query": "^5.45.1",
"@tanstack/react-table": "^8.17.3",
"@vercel/analytics": "^1.3.1",
Expand Down
8 changes: 0 additions & 8 deletions pnpm-lock.yaml

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

2 changes: 1 addition & 1 deletion postinstall.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash

# Set the package name
PACKAGE_NAME="@renegade-fi/tradingview-charts"
PACKAGE_NAME="@/lib/charts"

# Create necessary directories
mkdir -p ./public/static/datafeeds/udf/dist
Expand Down
14 changes: 11 additions & 3 deletions scripts/tradingview.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
#!/bin/bash

PACKAGE_NAME="@renegade-fi/tradingview-charts"
SUBMODULE_PATH="./lib/charts"

# Check if submodule exists
if [ ! -d "$SUBMODULE_PATH" ]; then
echo "Error: TradingView submodule not found at $SUBMODULE_PATH"
echo "Please ensure you've initialized the submodule with:"
echo "git submodule update --init --recursive"
exit 1
fi

# Create necessary directories
mkdir -p ./public/static/datafeeds/udf/dist
Expand All @@ -11,9 +19,9 @@ rm -rf ./public/static/datafeeds/udf/dist/bundle.js
rm -rf ./public/static/charting_library

# Copy the bundle.js file
cp ./node_modules/$PACKAGE_NAME/datafeeds/udf/dist/bundle.js ./public/static/datafeeds/udf/dist/bundle.js
cp $SUBMODULE_PATH/datafeeds/udf/dist/bundle.js ./public/static/datafeeds/udf/dist/bundle.js

# Copy the entire charting_library folder
cp -r ./node_modules/$PACKAGE_NAME/charting_library ./public/static/charting_library
cp -r $SUBMODULE_PATH/charting_library ./public/static/charting_library

echo "TradingView files copied successfully."
Loading