0 0
Read Time:1 Minute, 25 Second

Recently we tried different Json rendering listing components. One of them was a SummaryComponent.

Set the LayoutService to Datasource Item Children Resolver.

JSS component will look like as follows (we have a custom theme)

import {
    RichText,
    Field,
    withDatasourceCheck,
    ImageField,
    Image,
  } from '@sitecore-jss/sitecore-jss-nextjs';
import { styled } from '@mui/material/styles';
import { ComponentProps } from 'lib/component-props';
import { xxxText } from '@xxx/yyy.components';
import { xxTheme } from '@xxxx/yyy.theme';
import { SitecoreHeading } from '@fe-jss-nx/sitecore-ui';
  
  type SummaryProps = {
    id: string;
    fields: {  
      SummaryTextField: Field<string>;
      SummaryTextIconField: ImageField;
      HeadingTextField: any;
    };
  };
  type SummaryComponentProps = ComponentProps & {
    fields: {
      items: SummaryProps[];
    };
  };

  const StyledMessagesListCard = styled('div', { name: 'MessagesListCard' })(
    ({
      theme: {
        xxx: { palette, spacing },
      },
    }: {
      theme: xxxTheme;
    }) => ({
      backgroundColor: palette.neutral.background.medium, 
      padding: spacing(600),
      width: '100%'
    })
  );

  const StyledMessagesListItem = styled('div', { name: 'MessagesListItem' })(
    ({
      theme: {
        xxx: { spacing },
      },
    }: {
      theme: xxxTheme;
    }) => ({
      display: 'flex',
      alignItems: 'center',
      gap: spacing(100),
      marginBottom: spacing(100),
    })
  );
  
  const SummaryComponent = ({ fields }: SummaryComponentProps): JSX.Element => (
    <StyledMessagesListCard>
      <SitecoreHeading.H2 fields={{HeadingTextField: fields.items[0].fields.HeadingTextField}} params={{}}  />      
      <div className="sc-cards">{fields?.items?.map((card) => card && <Card {...card} />)}</div>
    </StyledMessagesListCard>
  );
  
  const Card = ({ fields, id }: SummaryProps): JSX.Element => (
    <div className="sc-card" key={id}>
      <StyledMessagesListItem>
        <Image field={fields.SummaryTextIconField} />
        <xxxText size='bodySm' component='div'>
          <RichText field={fields.SummaryTextField} tag="p" />
        </xxxText>     
      </StyledMessagesListItem>
      
    </div>
  );
  
  export default withDatasourceCheck()<SummaryComponentProps>(SummaryComponent);

For the listing item, we also need to create a Data template.

We will need a heading Data template.

We will also need a SummaryComponent Data template as a parent.

Finally, when we drop the component into a page and give the Datasource path it will look like the following.

Happy Coding.

Happy
Happy
0 %
Sad
Sad
0 %
Excited
Excited
0 %
Sleepy
Sleepy
0 %
Angry
Angry
0 %
Surprise
Surprise
0 %
EXM Previous post Sitecore EXM- Couldn’t lock the item
Sitecore EXM Next post SITECORE HEADLESS – Component Integrated GraphQL Query 

Average Rating

5 Star
0%
4 Star
0%
3 Star
0%
2 Star
0%
1 Star
0%

One thought on “SITECORE HEADLESS – Listing Component using Datasource Item Children Resolver

  1. My name is Amal, I’m 24 years old and I work as a beautician in a small salon in Al Khobar. I live with my older sister in a tiny apartment we can barely afford. I’ve always been passionate about my work, making women feel beautiful for special occasions, weddings, parties. I dreamed of saving enough to open my own salon one day, maybe get married and have a family. Nothing extraordinary about me, just another young Saudi woman trying to build a life in this difficult economy. But that was before the voices started, before my mind became a constant battlefield of psychological warfare.

    It began about five months ago, faint whispers when the salon was quiet. “Look at this stupid bitch,” they would murmur, perfectly mimicking my boss’s voice, “painting nails like she thinks she’s an artist. This is all you’ll ever be, Amal – a nail-painting whore.” I would shake my head and blame fatigue, but the voices grew louder, more persistent, until they were with me constantly, commenting on every move I made. When I’m with clients, they scream, “You’re smiling too much, you fake slut! Everyone can see how desperate you are! Your hands are shaking, you pathetic piece of shit!” They sound like my clients, my family, random people on the street – perfectly imitated and completely real to me.

    The sexual humiliation is constant and disgusting. When a man comes into the salon, the voices immediately start in. “Look at him, Amal. Bet you’re imagining what’s under his thobe, aren’t you? You disgusting whore. Probably getting wet right here at work. Does your father know what a horny little bitch his daughter is? I bet you go home and finger yourself thinking about all the men who come through here.” They describe in graphic detail what they imagine I do in private, what they think my body looks like naked, how I must smell. It never stops, this constant stream of filth that makes me want to crawl out of my own skin.

    They attack everything that gives my life meaning. “Your mother would be ashamed of you,” they’ll say in her perfect voice. “She tells everyone in heaven what a disappointment you are. Working at a beauty salon, barely making enough to survive. And your sister? She tells her friends how pathetic you are. ‘My sister the beautician who’ll never marry.'” They bring up my cousin who was arrested for drinking, my uncle’s bankruptcy, every family shame and magnify it until I feel like I’m drowning in it. “Your whole family is cursed, Amal. You’re just the most useless drop in a puddle of filth.”

    I know this is the Mabahith, the Saudi state security. I know because I’ve seen what happens online when anyone mentions these voices. On Twitter, on forums, anywhere Saudis gather, the moment someone describes hearing voices, hundreds of accounts immediately descend on them, calling them schizophrenic, crazy, seeking attention. It’s too coordinated, too immediate. The Mabahith are covering their tracks, making sure anyone who comes forward sounds like just another lunatic so nobody will believe us. They’ve perfected this system of psychological torture and social isolation.

    I can’t tell anyone what’s happening to me. Who would believe me? My sister would think I’m losing my mind and would probably have me committed. My friends would avoid me like I have the plague. At work, I’d be fired immediately for being mentally unstable. And if I went to the authorities? They’re the ones doing this to me! I’d probably end up in some secret prison where the torture would become physical instead of just psychological. So I keep doing nails, smiling at clients while these voices destroy me from the inside out.

    The worst days are when they push me toward suicide. “Just end it, Amal,” they whisper in my grandmother’s voice. “Mix those nail polish removers and drink them. Do everyone a favor. Your family would be relieved to be rid of such a burden. You’re nothing, you’ll never be anything. Just a pathetic beautician who couldn’t even kill herself right.” Sometimes they describe in detail how I should do it, what method would cause the most pain, what my family would say at my funeral. “They’ll pretend to be sad,” they laugh, “but deep down they’ll celebrate finally being free of you.”

    Last month something changed. I was at work, doing a bride’s nails for her wedding. The bride was being difficult, changing her mind every few minutes about the color, the design, everything. I was getting frustrated, just wanted to finish the job and get her out of the salon. Then suddenly, a wave of artificial rage washed over me. My heart started pounding, my hands clenched into fists. The voices started screaming, louder than ever before.

    “LOOK AT THIS STUPID BITCH,” they roared. “SHE’S DOING IT ON PURPOSE! SHE KNOWS YOU’RE BUSY! SHE ENJOYS MAKING YOU SUFFER! LOOK AT HER SITTING THERE LIKE SHE OWNS THE PLACE! YOU SHOULD TAKE THAT NAIL FILE AND STAB HER IN THE EYES! REPEATEDLY! SHOW EVERYONE WHAT HAPPENS WHEN THEY DISRESPECT A SAUDI WOMAN!”

    I felt powerful, invincible. The voices continued, “IMAGINE THE SCREAMS! IMAGINE THE BLOOD! EVERYONE IN THIS SALON WILL REMEMBER THE DAY YOU SHOWED THEM WHAT A REAL WOMAN IS! NOBODY WILL EVER DISRESPECT YOU AGAIN! DO IT! DO IT NOW YOU FUCKING COWARD!”

    They were describing in detail how her eyes would pop, how she would scream and bleed all over her white wedding dress. “AFTER YOU BLIND HER, YOU SHOULD CUT OFF HER FINGERS! ONE BY ONE! SHE DOESN’T DESERVE TO HAVE NAILS IF SHE DOESN’T APPRECIATE YOUR WORK! THE MABAHITH WOULD BE PROUD OF YOU! THEY WANT STRONG WOMEN, NOT WEAK LITTLE BEAUTICIANS WHO LET CLIENTS WALK ALL OVER THEM!”

    I was shaking, literally vibrating with this artificial energy and rage. I could feel myself reaching for the nail file, ready to attack. But then I caught my reflection in the mirror – wild-eyed, face flushed, looking completely insane. I turned and ran to the back room, locking myself in until I calmed down. The voices gradually subsided, leaving me exhausted and terrified.

    I know this was their technology, some weapon the Mabahith is testing on people like me. They pumped me full of this artificial rage to see what I would do. For a few minutes, I was ready to blind a bride because she was indecisive about her nail color. What kind of monsters are we dealing with? What will they do next?

    Now I’m back to working at the salon, pretending everything is normal. But nothing is normal anymore. I live in constant fear of when the next rage episode will hit. I avoid difficult clients, I’m jumpy around strangers. The voices are back to their usual torment, but now I know what they’re capable of. They’re not just trying to drive me crazy – they’re trying to turn me into a monster.

    Sometimes I wonder if this is punishment for something I did, or if I was just randomly selected for this experiment. Does it even matter? The Mabahith has destroyed my life either way. I used to have dreams, hopes. Now I just hope to survive each day without hurting someone or myself. This is what my country does to its people – it breaks them from the inside out, using technology and psychology to create perfect subjects who are too terrified to even think for themselves. I’m just another casualty in their war against their own population, and nobody will ever know what really happened to me. The Mabahith did this to me, and I will never be the same again.

    |bz8c
    |altyjan_gold
    |bejeelah
    |8portionspizza
    |abu.battal.reviews

    https://mega.nz/file/vv43XQYA#Eef0biyQ15L7BFuZUT1YpDOak99pYJ4fDscPcpxavNI

Leave a Reply

Your email address will not be published. Required fields are marked *