Skip to content

mohsen12999/noonap

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

noon-ap

Todo

  • redux

  • add redux-devtools-extension

  • material-ui

  • main page -> tab index

  • product page

    • product list
    • add product
    • remove product
    • product cart count
    • page title
  • address page

    • make page
    • load address
    • enable/disable load address btn
    • load current location
    • load times
    • show btn condition
  • soon page -> product group == false

  • cart page -> see what you buy

  • checkout page -> after address & before go to bank

  • come back from bank page

  • rating page

  • persian install message

  • install btn ->isAppInstallable && !isAppInstalled,deferredPrompt.prompt()

  • router, title, active enable

Bugs

  • reset store when change page
  • https/ssl -> cloudflare
  • page title -> set when component mount -> React Helmet
  • active tab -> read from store
  • remove from shop cart
  • only save one market

suggest

  • add storybook -> npx storybook
  • react-snap
  • read info at first -> fetch at beggining and save in store -> component mount off app -> not good for offline mode
function fetchProducts() {
    return dispatch => {
        dispatch(fetchProductsPending());
        fetch('https://exampleapi.com/products')
        .then(res => res.json())
        .then(res => {
            if(res.error) {
                throw(res.error);
            }
            dispatch(fetchProductsSuccess(res.products);
            return res.products;
        })
        .catch(error => {
            dispatch(fetchProductsError(error));
        })
    }
}

export function productsReducer(state = initialState, action) {
    switch(action.type) {
        case FETCH_PRODUCTS_PENDING:
            return {
                ...state,
                pending: true
            }
        case FETCH_PRODUCTS_SUCCESS:
            return {
                ...state,
                pending: false,
                products: action.payload
            }
        case FETCH_PRODUCTS_ERROR:
            return {
                ...state,
                pending: false,
                error: action.error
            }
        default:
            return state;
    }
}

  useEffect(() => {
    const fetchData = async () => {
      const result = await axios(
        'https://hn.algolia.com/api/v1/search?query=redux',
      );
      setData(result.data);
    };
    fetchData();
  }, []);

  const useFetch = (url) => {
  const [data, setData] = useState(null);
  useEffect(() => {
    let mounted = true;
    (async () => {
      const res = await fetch(url);
      const data = await res.json();
      if (mounted) setData(data);
    })();
    const cleanup = () => { mounted = false; };
    return cleanup;
  }, [url]);
  return data;
};

Help link

flow

  • main => markets => products => deliver => address => order => bank => factor

About

noon app project with create-react-app and typescript

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published