The purpose of life is true happiness. This can only be found within and not through external sources. I can only control my behaviours and actions, so I can only do my best to achieve a goal that aligns with my internal being. I cannot control the external judgment of my efforts. Mediocrity comes from allowing externals to influence your internal self. You have control to be happy at all times. This is barring some other external influence such as one’s body or more specifically mind that may be stuck in a depressive or manic episode, where control cannot be achieved without assistance. In summary I feel if one concedes to externals one’s will - true happiness cannot be found - which is in my opinion the meaning/purpose of life.
I hope you find your path to happiness, even in darkness. The light is always present and the darkness is also.