<commit_before>import React from 'react';

const RightRecipeDetails = ({
  season,
  type,
  price,
  editable,
  editing,
  cancelChanges,
  saveChanges,
  updateInput,
  switchToEdit,
  showError
}) => (
  <div className="recipe-details__part recipe-details__right">
    {editable && !editing ?
      <div className="section__edit-actions" style={{ left: '20rem', right: 'auto' }}>
        <button
          className="icon-button edit-actions__button"
          onClick={switchToEdit}
          name={'rightDetails'}
        >
          <i className="icon-pencil" />
        </button>
      </div> : null}
    {editable && editing ?
      <div className="section__edit-actions" style={{ left: '20rem', right: 'auto' }}>
        {!showError ?
          <button
            className="icon-button edit-actions__button"
            onClick={saveChanges}
            name={'rightDetails'}
          >
            <i className="icon-floppy-o" />
          </button> : null
        }
        <button
          className="icon-button edit-actions__button"
          onClick={cancelChanges}
          name={'rightDetails'}
        >
          <i className="icon-undo" />
        </button>
      </div> : null}
    <div>
      {editing ?
        <input
          className="edit-number-input"
          type="number"
          pattern="[0-9]*"
          step="5"
          name="price"
          value={price}
          onChange={updateInput}
        /> : ` ${price}`} xxx
      <i className="icon-clock-o" />
    </div>
    <div>
      {editing ?
        <input
          className="edit-number-input"
          type="number"
          pattern="[0-9]*"
          step="5"
          name="type"
          value={type}
          onChange={updateInput}
        /> : ` ${type}`} xxx
      <img src="/public/pan.svg" alt="pan" />
    </div>
    <div>
      {editing ?
        <input
          className="edit-number-input"
          type="number"
          pattern="[0-9]*"
          step="1"
          name="season"
          value={season}
          onChange={updateInput}
        /> : ` ${season}`}
      <i className="icon-group" />
    </div>
  </div>
);

export default RightRecipeDetails;<commit_msg>Update RecipePage.js<commit_after>import React from 'react';

const labels = {
  season: [
    'Toutes saisons',
    'Recette d\'hiver',
    'Recette de printemps',
    'Recette d\'été',
    'Recette d\'automne'
  ],
  price: ['Bon marché', 'Peu chère', 'Assez chère', 'Chère'],
  type: ['', 'Entrée', 'Plat principal', 'Accompagnement', 'Dessert']
};

// this will be used later if I want to add the icons
// const iconClasses = {
//   season: ['', 'winter', 'spring', 'summer', 'autumn'],
//   price: ['vcheap', 'cheap', 'exp', 'vexp'],
//   type: ['', 'starter', 'main-course', 'accomp', 'dessert']
// };

const RightRecipeDetails = ({
  season,
  type,
  price,
  editable,
  editing,
  cancelChanges,
  saveChanges,
  updateInput,
  switchToEdit,
  showError
}) => (
  <div className="recipe-details__part recipe-details__right">
    {editable && !editing ?
      <div className="section__edit-actions" style={{ left: '20rem', right: 'auto' }}>
        <button
          className="icon-button edit-actions__button"
          onClick={switchToEdit}
          name={'rightDetails'}
        >
          <i className="icon-pencil" />
        </button>
      </div> : null}
    {editable && editing ?
      <div className="section__edit-actions" style={{ left: '20rem', right: 'auto' }}>
        {!showError ?
          <button
            className="icon-button edit-actions__button"
            onClick={saveChanges}
            name={'rightDetails'}
          >
            <i className="icon-floppy-o" />
          </button> : null
        }
        <button
          className="icon-button edit-actions__button"
          onClick={cancelChanges}
          name={'rightDetails'}
        >
          <i className="icon-undo" />
        </button>
      </div> : null}
    <div>
      {editing ?
        <select value={price} onChange={updateInput}>
          {labels.price.map((label, i) => <option value={i}>{label}</option>)}
        </select> :
        labels.price[price]
      }
    </div>
    <div>
      {editing ?
        <select value={price} onChange={updateInput}>
          {labels.type.map((label, i) => (i > 0 ? <option value={i}>{label}</option> : null))}
        </select> :
        labels.type[type]
      }
    </div>
    <div>
      {editing ?
        <select value={price} onChange={updateInput}>
          {labels.season.map((label, i) => <option value={i}>{label}</option>)}
        </select> :
        labels.season[season]
      }
    </div>
  </div>
);

export default RightRecipeDetails;
{'fraction_non_alphanumeric': 0.16295353278166771, 'fraction_numerical': 0.0038192234245703373, 'mean_word_length': 2.0276172125883107, 'pattern_counts': {'":': 0, '<': 63, '<?xml version=': 0, '>': 69, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4806801', 'n_tokens_mistral': 1455, 'n_tokens_neox': 1469, 'n_words': 283}