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

DApp-1854 channel listing #1862

Merged

Conversation

rohitmalhotra1420
Copy link
Collaborator

Pull Request Template

Ticket Number

Description

  • Problem/Feature:

Type of Change

  • Bug fix
  • New feature
  • Code refactor
  • Documentation update
  • Other (please describe):

Checklist

  • Quick PR: Is this a quick PR? Can be approved before finishing a coffee.
    • Quick PR label added
  • Not Merge Ready: Is this PR dependent on some other PR/tasks and not ready to be merged right now.
    • DO NOT Merge PR label added

Frontend Guidelines

Build & Testing

  • No errors in the build terminal
  • Engineer has tested the changes on their local environment
  • Engineer has tested the changes on deploy preview

Screenshots/Video with Explanation

  • Before: Explain the previous behavior

  • After: What's changed now

Additional Context

Review & Approvals

  • Self-review completed
  • Code review by at least one other engineer
  • Documentation updates if applicable

Notes

@rohitmalhotra1420 rohitmalhotra1420 self-assigned this Sep 20, 2024
@rohitmalhotra1420 rohitmalhotra1420 merged commit a420b0d into DAPP-1856-channel-detail Sep 20, 2024
1 of 2 checks passed
Copy link

  • You are importing FC from 'react', so make sure to use React.FC instead.
  • There is a typo in 'Infrastrucuture', it should be 'Infrastructure'.
  • In the Pill component inside the map function, the key should be ${cat}-${index} instead of just ${index} to ensure unique keys.
  • It seems categories array is being referenced before it is defined in the file. Make sure to move the categories array declaration above the ChannelCategories component function.
  • There is no check for categoryContainerRef if it is null or not before using it in the scrollBy method. You might want to add a check to prevent any potential null reference errors.

Here is the corrected part of the code:

import React, { useRef } from 'react';
import { css } from 'styled-components';
import { Filters } from '../hooks/useChannelsFilters';

export type ChannelCategoriesProps = {
  filters: Filters;
  setFilter: (filter: Partial<Filters>) => void;
};

const scrollAmount = 150;

const ChannelCategories: React.FC<ChannelCategoriesProps> = ({ filters, setFilter }) => {
  const categoryContainerRef = useRef<HTMLDivElement>(null);

  const categories = [
    'All',
    'Subscribed',
    'DEFI',
    'DAO',
    'NFT',
    'Metaverse',
    'Tooling',
    'Infrastrucuture', // Typo: should be 'Infrastructure'
    'Gaming',
    'Social',
    'Serivce', // Typo: should be 'Service'
    'DEFI',
    'DAO',
    'NFT',
  ];

  return (
    <Box
      display="flex"
      alignItems="center"
      css={css`
        flex-shrink: 0;
      `}
      gap="spacing-xs"
      maxWidth={{ ml: '346px' }}
    >
      <Button
        iconOnly={<CaretLeft />}
        circular
        variant="outline"
        size="small"
        onClick={() => {
          if (categoryContainerRef.current) {
            categoryContainerRef.current.scrollBy({
              left: -scrollAmount,
              behavior: 'smooth',
            });
          }
        }}
      />
      <Box
        display="flex"
        overflow="hidden"
        gap="spacing-xs"
        width="100%"
        ref={categoryContainerRef}
      >
        {categories.map((cat, index) => (
          <Pill
            key={`${cat}-${index}`}
            isActive={cat === filters.category}
            onClick={() => setFilter({ category: cat })}
          >
            {cat}
          </Pill>
        ))}
      </Box>

      <Button
        iconOnly={<CaretRight />}
        circular
        variant="outline"
        size="small"
        onClick={() => {
          if (categoryContainerRef.current) {
            categoryContainerRef.current.scrollBy({
              left: scrollAmount,
              behavior: 'smooth',
            });
          }
        }}
      />
    </Box>
  );
};

export { ChannelCategories };

All looks good.

rohitmalhotra1420 added a commit that referenced this pull request Oct 18, 2024
* in progress

* added listing api

* Ui in progress

* fixed type

* implemented listing

* shifted to api call for channel list

* api fixes

* fixed the ui of card and category

* fixed param type

* added fixed

* scroll implemented

* fixed the pagination for channel list

* added listing and search

* added preview

* fixed the layout

* channel details page

* added responsiveness support

* added layout variant

* Update App.tsx

* fixed category scroll (#1862)

* added layout variant

* fixed review comments

* fixed review comments

* channel category implemented

* filters implmented

* channels listing page done

* debug turned off

* fixed review comments

* added null state

* fixed channel search hook

* PR fixes done

* fixed the edit channel for category

* fixed channel list search query

* Wrapped channel img in Link

* menu item label changes

* fixes done

* channel details card refactor

* outline button fix and category scroll fix

* spacing ui fixes done

* category added to channel profile

* added config channels

* added config channels

* fixed select

* fixed select

* added review changes

---------

Co-authored-by: rohitmalhotra1420 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant