diff --git a/app/controllers/admin/balances_controller.rb b/app/controllers/admin/balances_controller.rb deleted file mode 100644 index 7ab3220..0000000 --- a/app/controllers/admin/balances_controller.rb +++ /dev/null @@ -1,8 +0,0 @@ -# frozen_string_literal: true -module Admin - class BalancesController < Admin::ApplicationController - def valid_action?(name, resource = resource_class) - ["destroy"].exclude?(name.to_s) && super - end - end -end diff --git a/app/dashboards/balance_dashboard.rb b/app/dashboards/balance_dashboard.rb deleted file mode 100644 index 354c20b..0000000 --- a/app/dashboards/balance_dashboard.rb +++ /dev/null @@ -1,53 +0,0 @@ -# frozen_string_literal: true -require "administrate/base_dashboard" - -class BalanceDashboard < Administrate::BaseDashboard - # ATTRIBUTE_TYPES - # a hash that describes the type of each of the model's fields. - # - # Each different type represents an Administrate::Field object, - # which determines how the attribute is displayed - # on pages throughout the dashboard. - ATTRIBUTE_TYPES = { - user: Field::BelongsTo, - id: Field::Number, - amount: Field::String.with_options(searchable: false), - created_at: Field::DateTime, - updated_at: Field::DateTime, - }.freeze - - # COLLECTION_ATTRIBUTES - # an array of attributes that will be displayed on the model's index page. - # - # By default, it's limited to four items to reduce clutter on index pages. - # Feel free to add, remove, or rearrange items. - COLLECTION_ATTRIBUTES = [:user, :id, :amount].freeze - - # SHOW_PAGE_ATTRIBUTES - # an array of attributes that will be displayed on the model's show page. - SHOW_PAGE_ATTRIBUTES = [:user, :id, :amount, :created_at, :updated_at].freeze - - # FORM_ATTRIBUTES - # an array of attributes that will be displayed - # on the model's form (`new` and `edit`) pages. - FORM_ATTRIBUTES = [:user, :amount].freeze - - # COLLECTION_FILTERS - # a hash that defines filters that can be used while searching via the search - # field of the dashboard. - # - # For example to add an option to search for open resources by typing "open:" - # in the search field: - # - # COLLECTION_FILTERS = { - # open: ->(resources) { resources.where(open: true) } - # }.freeze - COLLECTION_FILTERS = {}.freeze - - # Overwrite this method to customize how balances are displayed - # across all pages of the admin dashboard. - # - # def display_resource(balance) - # "Balance ##{balance.id}" - # end -end diff --git a/app/graphql/mutations/create_sell_crypto_order.rb b/app/graphql/mutations/create_sell_crypto_order.rb index e8ca79a..f504b2a 100644 --- a/app/graphql/mutations/create_sell_crypto_order.rb +++ b/app/graphql/mutations/create_sell_crypto_order.rb @@ -9,10 +9,6 @@ module Mutations amount = BigDecimal(order[:amount]) ActiveRecord::Base.transaction do - current_user - .balance - .withdrawal!(amount) - record = SellCryptoOrder.create!( paid_amount: amount, user_id: current_user.id, diff --git a/app/graphql/mutations/create_stake_order.rb b/app/graphql/mutations/create_stake_order.rb index fabb38a..083275e 100644 --- a/app/graphql/mutations/create_stake_order.rb +++ b/app/graphql/mutations/create_stake_order.rb @@ -9,10 +9,6 @@ module Mutations amount = BigDecimal(order[:amount]) ActiveRecord::Base.transaction do - current_user - .balance - .withdrawal!(amount) - record = StakeOrder.create!( amount: amount, pool_name: order[:pool_name], diff --git a/app/graphql/types/balance_type.rb b/app/graphql/types/balance_type.rb deleted file mode 100644 index 76b8b6f..0000000 --- a/app/graphql/types/balance_type.rb +++ /dev/null @@ -1,12 +0,0 @@ -# frozen_string_literal: true -module Types - class BalanceType < Types::BaseObject - implements GraphQL::Types::Relay::Node - global_id_field :id - - graphql_name "Balance" - - field :id, ID, null: false - field :amount, String, null: false - end -end diff --git a/app/graphql/types/user_type.rb b/app/graphql/types/user_type.rb index de366bf..8221624 100644 --- a/app/graphql/types/user_type.rb +++ b/app/graphql/types/user_type.rb @@ -11,8 +11,6 @@ module Types field :first_name, String, null: false field :last_name, String, null: false field :wallet_address, String, null: true - - field :balance, BalanceType, null: false field :fiat_balance, FiatBalanceType, null: false end end diff --git a/app/graphql/x_stake_schema.rb b/app/graphql/x_stake_schema.rb index bca4b1f..6751934 100644 --- a/app/graphql/x_stake_schema.rb +++ b/app/graphql/x_stake_schema.rb @@ -6,8 +6,6 @@ class XStakeSchema < GraphQL::Schema def self.resolve_type(abstract_type, obj, ctx) case obj - when Balance - Types::BalanceType when FiatBalance Types::FiatBalanceType when SellCryptoOrder diff --git a/app/javascript/__generated__/schema.graphql b/app/javascript/__generated__/schema.graphql index ded7cbf..6091e7f 100644 --- a/app/javascript/__generated__/schema.graphql +++ b/app/javascript/__generated__/schema.graphql @@ -1,8 +1,3 @@ -type Balance implements Node { - amount: String! - id: ID! -} - type BuyCryptoOrder implements Node { createdAt: ISO8601DateTime! id: ID! @@ -553,7 +548,6 @@ input StakeOrderFilterInput { } type User { - balance: Balance! email: String! fiatBalance: FiatBalance! firstName: String! diff --git a/app/javascript/src/Routes.tsx b/app/javascript/src/Routes.tsx index db22c21..9ca3819 100644 --- a/app/javascript/src/Routes.tsx +++ b/app/javascript/src/Routes.tsx @@ -2,36 +2,29 @@ import type { FC } from "react"; import React from "react"; import { Switch, Route } from "react-router-dom"; -import { useCurrentUser } from "./contexts/UserProvider"; import { Dashbaord, Home, Orders, Wallet } from "./pages"; export const Routes: FC = () => { - const { isAuthenticated } = useCurrentUser(); - return ( - {isAuthenticated && ( - <> - - - - - - - - - - - - - - - - - )} + + + + + + + + + + + + + + + ); }; diff --git a/app/javascript/src/components/Navbar/Navbar.tsx b/app/javascript/src/components/Navbar/Navbar.tsx index fde8013..f0b87eb 100644 --- a/app/javascript/src/components/Navbar/Navbar.tsx +++ b/app/javascript/src/components/Navbar/Navbar.tsx @@ -25,8 +25,7 @@ export const Navbar = () => {